float print formatting

hg hg at nospam.org
Tue Feb 13 03:50:11 EST 2007


Grant Edwards wrote:

> On 2007-02-13, hg <hg at nospam.org> wrote:
>> Hi,
>>
>> Considering the float 0.0, I would like to print 00.00.
>>
>> I tried '%02.02f' % 0.0 ... but I get 0.00
>             ^^
> That's the specifierfor how many total columns you want to use
> (including the decimal point and all digits to either side).
> 
>> Any clue ?
> 
>>>> "%05.02f" % 0.0
> '00.00'
> 
> --
> Grant Edwards                   grante             Yow!  Yow!! "Janitor
>                                   at               trapped in sewer uses
>                                   ESP
>                                visi.com            to find decayed
>                                burger"!!

Thanks




More information about the Python-list mailing list