【编程语言】编码读取失败问题
作者:互联网
- UnicodeDecodeError: 'ascii' codec can't decode byte 0x8e in position 0: ordinal not in range(128)
import pickle
with open("data\\squeeze_net\\model.pkl",'rb') as f:
content = pickle.load(f, encoding='iso-8859-1')
print(content)
# 原来报错的内容
with open('dataset5.pkl', 'rb') as f:
train_set = pickle.load(f) # 就是这里!
即改变编码方式即可,建议直接采用这种方法
标签:load,编码,读取,编程语言,pickle,content,rb,open,pkl 来源: https://blog.csdn.net/weixin_31866177/article/details/113774390