Python Simple Conversion:
The simple conversion, with only a conversion type, is really easy to use:
>>> 'Using str: %s' % 99L
'Using str: 99'
>>> 'Using repr: %r' % 99L
'Using repr: 99L'
>>> 'Price of eggs: $%d' % 42
'Price of eggs: $42'
>>> 'Hexadecimal price of eggs: %x' % 42
'Hexadecimal price of eggs: 2a'
>>> from math import pi
>>> 'Pi: %f...' % pi
'Pi: 3.141593...'
>>> 'Very inexact estimate of pi: %i' % pi
'Very inexact estimate of pi: 3'
No comments:
Post a Comment