[python][oldboy]python涉及的几种编码

1 python文件代码中中文的识别 (换言之,python代码的中文不显示乱码)和解析u"中文"这样的unicode对象 # coding=utf8

2 python运行环境(IDE)系统的编码:

  import sys

  reload(sys)

  sys.setdefaultencoding('utf-8')

  这个是设置string的默认编码格式

  即string.encode('utf-8')

原文地址:https://www.cnblogs.com/liuzhipenglove/p/7324278.html