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:
[color=blue][color=green][color=darkred]
>>> print "%.2f" % 1024.36 # should be '1024,36'[/color][/color][/color]
1024.36[color=blue][color=green][color=darkred]
>>> string.letters #should be 54 letters here, including ñÑ[/color][/color][/color]
'abcdefghijklmn opqrstuvwxyzABC DEFGHIJKLMNOPQR STUVWXYZ'[color=blue][color=green][color=darkred]
>>> locale.getlocal e()[/color][/color][/color]
(None, None)[color=blue][color=green][color=darkred]
>>> locale.getdefau ltlocale()[/color][/color][/color]
('es_ES', 'cp1252')[color=blue][color=green][color=darkred]
>>> locale.setlocal e(locale.LC_ALL , locale.getdefau ltlocale())[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python23\li b\locale.py", line 381, in setlocale
return _setlocale(cate gory, 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
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:
[color=blue][color=green][color=darkred]
>>> print "%.2f" % 1024.36 # should be '1024,36'[/color][/color][/color]
1024.36[color=blue][color=green][color=darkred]
>>> string.letters #should be 54 letters here, including ñÑ[/color][/color][/color]
'abcdefghijklmn opqrstuvwxyzABC DEFGHIJKLMNOPQR STUVWXYZ'[color=blue][color=green][color=darkred]
>>> locale.getlocal e()[/color][/color][/color]
(None, None)[color=blue][color=green][color=darkred]
>>> locale.getdefau ltlocale()[/color][/color][/color]
('es_ES', 'cp1252')[color=blue][color=green][color=darkred]
>>> locale.setlocal e(locale.LC_ALL , locale.getdefau ltlocale())[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
File "C:\Python23\li b\locale.py", line 381, in setlocale
return _setlocale(cate gory, 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
Comment