无法在Python 3.6中使用_pickle加载Python 2.x .dat文件

时间:2019-03-17 17:34:57

标签: python pickle

我正在尝试在Python 3.6中使用_pickleDeepSig加载.dat文件(RML2016_10b.dat)无线电数据集,如下所示:

from _pickle import load, dump
Xd = load(open("RML2016_10b.dat", 'rb'))

但是我不断收到以下错误:

Traceback (most recent call last):
  File "C:/Users/anoir/PycharmProjects/AMC/classification.py", line 14, in <module>
    Xd = load(open("RML2016_10b.dat", 'rb'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xde in position 0: ordinal not in range(128)

有人可以给我解决方案吗?

1 个答案:

答案 0 :(得分:0)

感谢 H4Kor 来自_pickle的导入负载,转储

from _pickle import load, dump
Xd = load(open("RML2016_10b.dat", 'rb'), encoding='latin1')