String Simple Conversion:
# The simple conversion, with only a conversion type, is really easy to use:
print 'Price of eggs: $%d' % 42
print 'Hexadecimal price of eggs: %x' % 42
from math import pi
print 'Pi: %f...' % pi
print 'Very inexact estimate of pi: %i' % pi
print 'Using str: %s' % 42L
print 'Using repr: %r' % 42L
Related examples in the same category