存档

  • Windows 下 python 的源码字符集编码与 locale

    测试 Windows 下 python 的源码字符集编码,还有 python 程序的默认 locale。
    python 的源码字符编码
    当 python 程序中用到 ASCII 以外的字符时,需要指定源码的字符集编码,方法参考:PEP 0263: Defining Python Source Code Encodings。
    常用的几种 python 源码字符编码指示方法如下:

    Python will default to ASCII as standard encoding if no other
    encoding hints are given.
    To define a source code encoding, a magic comment must
    be placed into the source files either as first or second
    line in the [...]

    2010年5月1日 | 归档于 Python 编程
    标签:
‘Python 编程’ 分类的存档