Leading zeroes problem

Martin Franklin mfranklin1 at gatwick.westerngeco.slb.com
Thu May 16 18:10:33 EDT 2002


On Thursday 16 May 2002 9:04 pm, jb wrote:
> How do I get '00.0' from 0.0. I can say '%03d' % 0 but with floating point
> numbers this does not work.



I guess you could try the zfill string method....

>>> import string
>>> n="0.0021"
>>> string.zfill(n, 10)
'00000.0021'





More information about the Python-list mailing list