python3中带有pickle包对pkl文件进行操作。
打开带有中文的pkl文件或者其他字符的文件不能用默认的ascii格式打开,需要指定编码格式:
import pickle
# f = open('dict_word.pkl', 'rb')
# for line in f:
# print(line)
word = pickle.load(open("word.pkl", 'rb'), encoding='utf-8')
train = pickle.load(open("train.pkl", 'rb'),encoding='iso-8859-1')