Paul Volkov wrote:

> 2013/3/7 Peter Otten <__pete...@web.de>:
>> Last not least there's the option to employ locale-aware formatting:
>>
>>>>> import locale
>>>>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
>> 'en_US.UTF-8'
>>>>> locale.format("%d", 12345, grouping=True)
>> '12,345'
>>
>> In German usage of "." and "," is reversed, so:
>>
>>>>> locale.setlocale(locale.LC_ALL, "de_DE.UTF-8")
>> 'de_DE.UTF-8'
>>>>> locale.format("%d", 12345, grouping=True)
>> '12.345'
> 
> Does this locale-aware example only work on UNIX?

If you have Windows in mind: I don't know what it takes to get multiple 
locales on a Windows system, but for the default locale that you can specify 
with

locale.setlocale(locale.LC_ALL, "")

it should work.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to