string.zfill() pads a numeric string on the left with zeros. : zfill « String « Python






string.zfill() pads a numeric string on the left with zeros.

 

It understands about plus and minus signs:


import string
print string.zfill('12', 5)
print string.zfill('-3.14', 7)
print string.zfill('3.14159265359', 5)

   
  








Related examples in the same category