Python Locales under windows

M

Moof

Hi there,
I'm trying to use some country-specific services provided by python
under Windows, and I'm coming up with a couple of problems, specifically
that floats are not being printed correctly when converted to strings
(they print out as 1,024.36 instead of 1.024,36), and also the contents
of \w inside a regexp, which I believe is equivalent to string.letters.

Under linux, I can get around this by setting the locale correctly.
Under windows, I'm buggered if I can work out how:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python23\lib\locale.py", line 381, in setlocale
return _setlocale(category, locale)
Error: locale setting not supported

That's the clincher: I can't seem to set locales. Why is this? IS there
a way to get around this?

I'm using python 2.3 under Windows XP and 2K.

Moof
 
G

Guest


[Linux/ Python-2.3.1]
well this doesnt work under Linux neither, you need to use:

locale.format( "%.2f", 1024.36)

after setting the locale
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

Its the same here even afer locale was set, but maybe thats because my Linux
locale is mk_MK.UTF8

I'm using python 2.3 under Windows XP and 2K.

There is "locale.windows_locale" that may help you, although I don't
knowwhat this dictionary is about.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top