美文网首页
#我的笔记#Python bug

#我的笔记#Python bug

作者: plutoG7 | 来源:发表于2016-12-26 18:21 被阅读8次

乱码

1、中文乱码
import sys
reload(sys)
sys.setdefaultencoding('utf-8') #允许打印unicode字符

2、对于中文路径的读入可以这样:(假设filepath是你要读出的含有中文的文件路径):
filepath=unicode(filepath,'utf8')
fobj=open(filepath,"r")

3、# -- coding: utf-8 --

文件配置

更换系统或者复制系统文件,配置路径需要更改

参数默认

有默认值的参数可以缺省

相关文章

网友评论

      本文标题:#我的笔记#Python bug

      本文链接:https://www.haomeiwen.com/subject/rzojvttx.html