使用python pickle保存和加载大字典

时间:2016-06-07 08:35:32

标签: python dictionary pickle large-data

我有一本字典,它的大小是5300键。我想使用pickle.dump保存该字典:

with open("file.txt", "wb") as f:
        data.dump(result, f)

并使用pickle.load加载:

with open(path+"file.txt","rb") as f:
        data = pickle.load(f)

但是有一个memory error因为字典的大小。我正在使用Windows 4GB RAM和Python 2.7。 我不知道如何解决这个问题,还有另一种处理大字典泡菜的方法吗?

谢谢你的建议......

0 个答案:

没有答案
相关问题