phoenix13

导航

 

1. 如果是从文件中读入的中文,可以用notepad++打开来看文件的编码。

然后对应decode

 print words.decode('utf-8')

http://openhome.cc/Gossip/Encoding/Python.html

2. 

http://stackoverflow.com/questions/21393758/unicodedecodeerror-ascii-codec-cant-decode-byte-0xe5-in-position-0-ordinal

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

 

posted on 2015-06-20 14:24  phoenix13  阅读(289)  评论(0编辑  收藏  举报