ITeye博客

Python 国际化

mcgtts · 2011-09-18 11:14 · Python · 编程语言 · Markdown

>>> help(locale)
Help on module locale:

NAME
    locale - Locale support.

FILE
    c:\python27\lib\locale.py

DESCRIPTION
    The module provides low-level access to the C lib's locale APIs
    and adds high level number formatting APIs as well as a locale
    aliasing engine to complement these.
    
    The aliasing engine includes support for many commonly used locale
    names and maps them to values suitable for passing to the C lib's
    setlocale() function. It also includes default encodings for all
    supported locale names.

>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
"Chinese (Simplified)_People's Republic of China.936"

>>> lang, encoding = locale.getdefaultlocale()
>>> print lang
zh_CN
>>> print encoding
cp936
>>> 

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。