Pickle dump huge file without memory error

后端 未结 9 909
梦谈多话
梦谈多话 2020-12-23 14:26

I have a program where I basically adjust the probability of certain things happening based on what is already known. My file of data is already saved as a pickle

9条回答
  •  清歌不尽
    2020-12-23 14:42

    How about this?

    import cPickle as pickle
    p = pickle.Pickler(open("temp.p","wb")) 
    p.fast = True 
    p.dump(d) # d could be your dictionary or any file
    

提交回复
热议问题