locale.format without trailing zeros
przemolicc at poczta.fm
przemolicc at poczta.fm
Mon Aug 22 04:52:53 EDT 2011
Hello,
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "pl_PL")
'pl_PL'
>>> i=0.20
>>> j=0.25
>>> locale.format('%f', i)
'0,200000'
>>> locale.format('%f', j)
'0,250000'
I need to print the numbers in the following format:
'0,2' (i)
'0,25' (j)
So the last trailing zeros are not printed.
Regards
Przemyslaw Bak (przemol)
----------------------------------------------------------------
Najwieksza baza najtanszych ofert mieszkaniowych
http://linkint.pl/f2a0e
More information about the Python-list
mailing list