我使用python 3.4和win 7 64位系统.我运行了以下代码:
6 """ load single batch of cifar """
7 with open(filename, 'r') as f:
----> 8 datadict = pickle.load(f)
9 X = datadict['data']
Run Code Online (Sandbox Code Playgroud)
错误的信息是 UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence
我将第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']
Run Code Online (Sandbox Code Playgroud)
错误的信息变成了UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte. …