原本代码是这样的
fo = open(file, 'rb')
dict = pickle.load(fo)
修改之后只需要在打开的时候指定编码
fo = open(file, 'rb')dict = pickle.load(fo,encoding='iso-8859-1')
python2的时候是
import sys reload(sys) sys.setdefaultencoding('utf8')在python3.X中已经不再使用
原本代码是这样的
fo = open(file, 'rb')
dict = pickle.load(fo)
修改之后只需要在打开的时候指定编码
fo = open(file, 'rb')dict = pickle.load(fo,encoding='iso-8859-1')
python2的时候是
import sys reload(sys) sys.setdefaultencoding('utf8')在python3.X中已经不再使用