为了账号安全,请及时绑定邮箱和手机立即绑定

python 3.4中,'gbk' codec can't decode byte 0x80 in position 0

python 3.4中,'gbk' codec can't decode byte 0x80 in position 0

12345678_0001 2019-02-25 20:19:33
本人使用python 3.4,win7 64位操作系统,当 6 """ load single batch of cifar """ 7 with open(filename, 'r') as f: ----> 8 datadict = pickle.load(f) 9 X = datadict['data'] 错误信息是UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence 我把line 7 改成了 6 """ load single batch of cifar """ 7 with open(filename, 'r',encoding='utf-8") as f: ----> 8 datadict = pickle.load(f) 9 X = datadict['data'] 311 # decode input (taking the buffer into account) 312 data = self.buffer + input --> 313 (result, consumed) = self._buffer_decode(data, self.errors, final) 314 # keep undecoded input until the next call 315 self.buffer = data[consumed:] 错误的最终指向了 Python34\lib\codecs.py in decode(self, input, final)。 错误信息是UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte。 请问具体是编解码哪块出了问题,怎么解决?
查看完整描述

3 回答

?
慕少森

TA贡献2019条经验 获得超9个赞

出现一个中文逗号

查看完整回答
反对 回复 2019-03-01
  • 3 回答
  • 0 关注
  • 1226 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信