‘%03.1f’ works (1 could be any number, or empty string):
>>> "%06.2f"%3.3
'003.30'
>>> "%04.f"%3.2
'0003'
Note that the field width includes the decimal and fractional digits.
‘%03.1f’ works (1 could be any number, or empty string):
>>> "%06.2f"%3.3
'003.30'
>>> "%04.f"%3.2
'0003'
Note that the field width includes the decimal and fractional digits.