# using format() method print('I love {} for "{}!"'.format('Geeks', 'Geeks')) # using format() method and refering # a position of the object print('{0} and {1}'.format('Geeks', 'Portal')) print('{1} and {0}'.format('Geeks', 'Portal'))
for x in numbers: print "{:10.4f}".format(x) prints 23.2300 0.1233 1.0000 4.2230 9887.2000
print("<string> %d" %(<int>))
print('{} {}'.format('one', 'two'))
'{} {}'.format('one', 'two')
3.141593