简体   繁体   中英

How to select Japanese locale on Windows?

When I try

import locale
locale.setlocale(locale.LC_COLLATE, 'ja-JP')

I get the error message

locale.Error: unsupported locale setting

How do I fix that? I'm using Python 2.7.3 on Windows 7.

If you're using windows, this doesn't work because the japanese locale is 'jpn'. Try:

locale.setlocale(locale.LC_COLLATE, 'jpn')

Here is a list of country/region strings supported.

在Windows上,必须将字符串“ japanese”而不是“ ja-JP”用作locale.setlocale()的第二个参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM