Richard
0
Q:

printf python

# 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')) 
8
for x in numbers:
    print "{:10.4f}".format(x)
prints

   23.2300
    0.1233
    1.0000
    4.2230
 9887.2000
1
print("<string> %d" %(<int>))
2
print('{} {}'.format('one', 'two'))
1
'{} {}'.format('one', 'two')
1

New to Communities?

Join the community