Changing the decimal separator to a comma
Jeff Epler
jepler at unpythonic.net
Tue Aug 31 10:28:26 EDT 2004
Nothing changes the way that %-formatting works.
However, after calling locale.setlocale, locale.format should give you a
proper localized number:
>>> import locale
>>> locale.setlocale(locale.LC_ALL,"de_DE")
'de_DE'
>>> locale.format("%10.2f", 0.123)
' 0,12'
>>> locale.format("%10.2f", 1234.567)
' 1234,57'
>>> locale.format("%10.2f", 1234.567, grouping=True)
' 1.234,57'
Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040831/a746d6d2/attachment.sig>
More information about the Python-list
mailing list