# string handling # here are a few string handling possibilities listed: # .split(sep) # It is used to split a string at the position where the separator sep # appears. Here the separator sep is ":" (the one appearing in braces) # A list is returned. txt = "me:you:they" foo = txt.split(":") # foo holds now a list that looks like ["me","you","they"] print foo # sep.join(x) # It concatenates a sequence of strings x into a single string, with sep added between each item. txt = ':'.join(["me","you","they"]) # txt holds now a string that looks like "me:you:they" print txt # concatenating strings can be done also in the following way a = "me" b = "you" c = "they" txt = a + b + c # txt holds now a string that looks like "meyouthey" print txt txt_2 = a + ":" + b + ":" + c # txt_2 holds now a string that looks like "me:you:they" print txt_2 # Converting from integer to a string a = str(10) # a holds the string like "10" # Converting from integer to a unicode string a = unicode(10) # a holds the unicode string kind of like u"10" # Converting from string "10" to integer 10 a = int("10") # a holds the integer 10