Mulig SPAM: float print formatting

NOSPAM plz nospam at riddergarn.dk
Tue Feb 13 09:06:17 EST 2007


hg skrev:
> Hi,
>
> Considering the float 0.0, I would like to print 00.00.
>
> I tried '%02.02f' % 0.0 ... but I get 0.00
>
> Any clue ?
>
> Thanks,
>
> hg
>
>   
Try this:

a = 45.45 # the floating number

print "some text",
print a,
print "some text again"

or just this:

print "some text",
print 45.45,
print "some text again"

Hope it helped :D

Andreas





More information about the Python-list mailing list