Leading zeroes problem

Tino Lange tl_news at nexgo.de
Thu May 16 17:15:49 EDT 2002


On Thu, 16 May 2002 23:04:57 +0200, jb <jblazi at hotmail.com> wrote:

>How do I get '00.0' from 0.0. I can say '%03d' % 0 but with floating point 
>numbers this does not work.

Try this:

>>> print '%04.1f' % 0
00.0

here are some hints:
http://www.python.org/doc/current/lib/typesseq-strings.html

Tino




More information about the Python-list mailing list