Format a number as currency! I can't find any help on this simple problem.

Peter Otten __peter__ at
Tue Oct 17 17:05:34 CEST 2006

jr wrote:

>> >>> import locale
>> >>> locale.setlocale(locale.LC_ALL, 'English_United States.1252')
>> 'English_United States.1252'

> Just tried the first 2 commands on win XP, Python 2.5 under Idle.
> An Error is raised: "unsupported locale setting" (lib/ in
> setlocale, line 476).
> Actually I get the error also under Python 2.4.3
> Any idea what I'm missing?

Let your machine decide

>>> locale.setlocale(locale.LC_ALL, "")

or try something less specific:

>>> locale.setlocale(locale.LC_ALL, "en_US")


More information about the Python-list mailing list