With an int: >>> '%d' % 4 '4' >>> '%.2d' % 4 '04' >>> '%2d' % 4 ' 4' >>> '%2.2d' % 4 '04' But with a float: >>> '%f' % 2.33 '2.330000' >>> '%.2f' % 2.33 '2.33' >>> '%2.f' % 2.33 ' 2' >>> '%2.2f' % 2.33 '2.33' Why in this last line I don't get ' 2.33'? I'm using Python 2.3.3 on Linux. Thank you! . Facundo