24.01.2013, 15:53
If you had the float value 3.1, the format %01.2f would set the string to "03. 1", which is not what you want.
The way it works, is that you put a 0 in front of a number. That number is the minimum amount of digits. %04f would always return a float with the format XXXX.XXXXX (standard 5 decimals), while the format %04.02f would always return a float with the format XXXX.XX.
The way it works, is that you put a 0 in front of a number. That number is the minimum amount of digits. %04f would always return a float with the format XXXX.XXXXX (standard 5 decimals), while the format %04.02f would always return a float with the format XXXX.XX.