2017-08-26 67 views
0

我试图用泡菜模块时读取来自DEAP数据集.dat文件(http://www.eecs.qmul.ac.uk/mmv/datasets/deap/readme.html) 但阅读Python中的* .dat文件,这个错误occures:从数据集

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 0: ordinal not in range(128) 

这是简单的代码:dataset = pc.load(open('dataset/s01.dat','rb'))

所以我的问题是: 1.我怎么读它? 2.我应该使用哪个模块?

+0

的可能的复制[取储存用蟒2对象蟒3](https://stackoverflow.com/questions/28218466/unpickling-a-python-2-object-with -python-3) –

回答

0

尝试此,

with open('dataset/s01.dat', 'rb') as f: 
    x = cPickle.load(f, encoding='latin1')