use the string format operator ( % ), or put all of the substrings in a list, and using one join() call to put them all together : Format : String PYTHON TUTORIALS


PYTHON TUTORIALS » String » Format »

 

use the string format operator ( % ), or put all of the substrings in a list, and using one join() call to put them all together


print '%s %s' % ('Spanish', 'Inquisition')
s = ' '.join(('Spanish', 'Inquisition', 'Made Easy'))
print s
# no need to import string to use string.upper():
print ('%s%s' % (s[:3], s[20])).upper()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo String
» Format