locale.getlocale() in cmd.exe vs. Idle
Albert-Jan Roskam
fomcl at yahoo.com
Mon Nov 10 04:22:03 EST 2014
Hi,
Why do I get different output for locale.getlocale() in Idle vs. cmd.exe?
# IDLE
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import locale
>>> locale.getdefaultlocale()
('nl_NL', 'cp1252')
>>> locale.getlocale()
('Dutch_Netherlands', '1252') # I need this specific notation
>>>
# cmd.exe or Ipython
C:\Users\albertjan>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getdefaultlocale()
('nl_NL', 'cp1252')
>>> locale.getlocale()
(None, None)
# using setlocale does work (one of these instances when I answer my own question while writing to the Python list)
C:\Users\albertjan>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'Dutch_Netherlands.1252'
>>> locale.getlocale()
('Dutch_Netherlands', '1252')
Thank you!
Regards,
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Python-list
mailing list