|
【基本介绍】
Python的编码问题,永无止境。
【错误介绍】
系统默认的编码是ascii
[iyunv@vpn ~]# python
Python 2.6.8 (unknown, Nov 7 2012, 14:47:45)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.getdefaultencoding()
ascii
>>>
在报错的文件中临时添加utf8 或者 gb18030
import sys
reload(sys)
sys.setdefaultencoding('utf8')
【参考】
http://blog.csdn.net/meylovezn/article/details/18080515
http://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte |
|
|