[Python-Dev] locale and LC_NUMERIC (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Mon Jan 9 00:33:27 CET 2006


Georg Brandl wrote:

>>> import locale >>> locale.setlocale(locale.LCNUMERIC, "") 'deDE at euro' >>> "%f" % 1.0 '1.000000' >>> u"%f" % 1.0 u'1,000000' >>>

Is this intended? This breaks testformat on my box when testbuiltin (method testfloatwithcomma) is executed first.

No. %-formatting should always use the C locale. One should use locale.format to get locale-aware formatting.

Regards, Martin



More information about the Python-Dev mailing list