Leading zeroes problem

Geoff Gerrietts geoff at gerrietts.net
Thu May 16 17:08:22 EDT 2002


Quoting jb (jblazi at hotmail.com):
> How do I get '00.0' from 0.0. I can say '%03d' % 0 but with floating
> point numbers this does not work.

You can use:

"%04.1f" % 0.0

that'll give you what you're asking for, but it may not be exactly
what you want.

-- 
Geoff Gerrietts        <geoff at gerrietts dot net>
"Ordinarily he was insane, but he had lucid moments 
when he was merely stupid."        --Heinrich Heine





More information about the Python-list mailing list