float print formatting

hg hg at nospam.org
Tue Feb 13 02:34:10 EST 2007


Peter Otten wrote:

> hg wrote:
> 
>> 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 ?
> 
> The first integer specifies the total width:
> 
>>>> "%05.2f" % 0
> '00.00'
> 
> Peter

Many thanks !

hg




More information about the Python-list mailing list