1
這個問題可能看起來有點基礎,但無法找到任何我在互聯網上理解的東西。如何儲存我用蒔蘿醃製的東西?如何蒔蘿(醃菜)檔案?
我已經走到這一步救了我的構造(熊貓據幀,其中還包含自定義類):
import dill
dill_file = open("data/2017-02-10_21:43_resultstatsDF", "wb")
dill_file.write(dill.dumps(resultstatsDF))
dill_file.close()
和閱讀
dill_file = open("data/2017-02-10_21:43_resultstatsDF", "rb")
resultstatsDF_out = dill.load(dill_file.read())
dill_file.close()
但閱讀時,我我得到的錯誤
TypeError: file must have 'read' and 'readline' attributes
我該怎麼做?