Strings Concatenation with (+)
Example
>>> 'spaish' + 'inquisition' 'spaishinquisition' >>> 'spanich' + ' ' + 'inquisition' 'spanich inquisition' >>> s = 'spanish' + ' ' + 'inquition' + 'made easy' >>> s 'spanish inquitionmade easy' >>> import string >>> string.upper(s[:3] + s[20]) 'SPAE'
The last example illustrates using the concatenation operator to put together a pair of slices from string s, the “Spa” from “Spanish” and the “M” from “Made.” The extracted slices are concatenated and then sent to the string.upper() function to convert the new string to all uppercase letters.