Localized month names
从python google groups(http://groups.google.com/group/comp.lang.python/browse_thread/thread/fc6150904657dcc4)看到的,获取某种编码的月份名称:
import locale
locale.setlocale(locale.LC_ALL, “zh_CN.utf-8″)
locale.nl_langinfo(locale.MON_1)
得到的输出是
\xe4\xb8\x80\xe6\x9c\x88
不知道如何转换成中文?
注意,不支持windows(I like linux :P),在linux下要支持相应的locale,例如我的gentoo中就没有de_DE.UTF-8,所以 执行
locale.setlocale(locale.LC_ALL, “de_DE.utf-8″)就会报错。
Write a comment