cross platform use of set locale
Serge Orlov
Serge.Orlov at gmail.com
Wed Mar 23 05:34:06 EST 2005
Timothy Smith wrote:
> thats ok, but how do i get it to group thousands with a , ?
> and thats would mean i'd have to run everything through a formatter
> before i displayed it :/ it'd be nicer if i could just select a
> proper locale
I think you're misusing locale. There is no guarantee that any specific
locale will have properties (like grouping) set to a known value.
Are you trying to format money? Then you need a special class so that
you can say:
d = Dollars(1000000.01)
print "You have %s in your account" % d
and get
You have $1,000,000.01 in your account.
Serge.
More information about the Python-list
mailing list