How to set Python default locale on Windows?

2019-04-02 04:05发布

I know I change change the locale for an application using

import locale
locale.setlocale(locale.LC_ALL, '')

Documentation says default value for locale usually comes from LANG environment variable. However, on Windows platform, it seems to be different. Where does Python takes the default value for locale? Is there a way to change this default value for all my Python scripts?

2条回答
倾城 Initia
2楼-- · 2019-04-02 04:59

The default system locale for a windows system can be set via the control panel. Python uses this default locale when you call setlocale with '' as the second argument. See here on how to change the default locale.

查看更多
forever°为你锁心
3楼-- · 2019-04-02 05:04

It is the value you've set in Control Panel.

查看更多
登录 后发表回答