最佳答案
我试图以区域设置感知的方式对字符串列表进行排序。我使用 Babel 库处理其他与 i18n 相关的任务,但它不支持排序。Python 的 locale
模块提供了一个 strcoll
函数,但是需要将进程的地区设置为我想要使用的地区。有点痛,但我能忍受。
问题是我似乎不能真正设置地区。locale
模块的 文件给出了这个例子:
import locale
locale.setlocale(locale.LC_ALL, 'de_DE')
当我运行它的时候,我得到了这个:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\Lib\locale.py", line 494, in setlocale
locale.Error: unsupported locale setting
我做错了什么?