【发布时间】:2009-08-09 01:45:21
【问题描述】:
当尝试腌制 numpy 中定义的对象 Inf(我认为)时,转储正常,但加载失败:
>>> cPickle.dump(Inf, file("c:/temp/a.pcl",'wb'))
>>> cPickle.load(file("c:/temp/a.pcl",'rb'))
Traceback (most recent call last):
File "<pyshell#257>", line 1, in <module>
cPickle.load(file("c:/temp/a.pcl",'rb'))
ValueError: could not convert string to float
>>> type(Inf)
<type 'float'>
这是为什么呢? 而且 - 有没有办法解决这个问题?我想腌制其中包含 Inf 的东西 - 将其更改为其他东西会破坏程序的优雅......
谢谢
【问题讨论】: