2

2017-04-03  本文已影响0人  woodsouthmmm

error

encoding problem

print key+"\t"+c[key].encode('utf-8','ignore')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal not in range(128)

solution

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

add this to the python file

ref

http://blog.csdn.net/use_my_heart/article/details/51303317

reflection

最近解决问题的方法都好暴力啊...中文编码是个经常碰到的问题、哪天总结一下好了...

上一篇下一篇

猜你喜欢

热点阅读