Floating Number format problem

人言落日是天涯,望极天涯不见家 kelvin.you at gmail.com
Tue Jun 12 03:10:59 EDT 2007


How could I format the float number like this: (keep 2 digit
precision)
1.002 => 1
1.12  => 1.12
1.00  => 1
1.567 => 1.57
2324.012 => 2324.01

I can not find any Formatting Operations is able to meet my
requirement.
Any suggestion will be appreciated.




More information about the Python-list mailing list