本人使用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。请问具体是编解码哪块出了问题,怎么解决?
添加回答
举报
0/150
提交
取消