How to print zero-padded floating point numbers in python 2.6.1

Lutz Horn lutz.horn at fastmail.fm
Wed Nov 4 09:25:53 CET 2009


Lorenzo Di Gregorio schrieb:
> print '%2.2F' % 3.5
> 3.50
> print '%02.2F' % 3.5
> 3.50
> 
> How can I get print (in a simple way) to print 03.50?

print '%05.2F' % 3.5

Lutz



More information about the Python-list mailing list