Converting a floating point number to a string
Carel Fellinger
cfelling at iae.nl
Sun Feb 27 16:18:32 EST 2000
kurtn at my-deja.com wrote:
> As the subject says I would like to convert a
> floating point number to a string, in other words
other pointed you in the direction of the simple "str" call, but if
more control over the layout is needed you might use the "%" trickery like:
>>> '%5.2f' % 123.4567
123.45
>>> '%5.2e' % 123.4567
1.23e+02
have fun
--
groetjes, carel
More information about the Python-list
mailing list