WORKING WITH STRINGS
A string in Python2 is a sequence of ASCII-encoded bytes. You can concatenate two strings using the ‘+’ operator. The following example prints a string and then concatenates two single-letter strings:
>>> 'abc' 'abc' >>> 'a' + 'b' 'ab'
You can use '+' or '*' to concatenate identical strings, as shown here:
>>> 'a' + 'a' + 'a' 'aaa' >>> 'a' * 3 'aaa'
You can assign strings to variables and print them using the print() statement:
>>> print('abc')
abc
>>> x = 'abc'
>>> print(x)
abc
>>> y = 'def'
>>> print(x + y)
abcdef
You can “unpack” the letters of a string and assign them to variables, as shown here:
>>> str = "World" >>> x1,x2,x3,x4,x5 = str >>> x1 'W&apos...