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

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

哔哔one 2019-04-16 20:27:55
本人使用python3.4,win764位操作系统,当6"""loadsinglebatchofcifar"""7withopen(filename,'r')asf:---->8datadict=pickle.load(f)9X=datadict['data']错误信息是UnicodeDecodeError:'gbk'codeccan'tdecodebyte0x80inposition0:illegalmultibytesequence我把line7改成了6"""loadsinglebatchofcifar"""7withopen(filename,'r',encoding='utf-8")asf:---->8datadict=pickle.load(f)9X=datadict['data']311#decodeinput(takingthebufferintoaccount)312data=self.buffer+input-->313(result,consumed)=self._buffer_decode(data,self.errors,final)314#keepundecodedinputuntilthenextcall315self.buffer=data[consumed:]错误的最终指向了Python34\lib\codecs.pyindecode(self,input,final)。错误信息是UnicodeDecodeError:'utf-8'codeccan'tdecodebyte0x80inposition0:invalidstartbyte。请问具体是编解码哪块出了问题,怎么解决?
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 428 浏览
慕课专栏
更多

添加回答

举报

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