- 保存
import pickle
f = open('data.pkl','wb')
pickle.dump(data,f)
f.close()
- 读取
import pickle
f = open('data.pkl','rb')
read_data = pickle.load(f)
f.close()
import pickle
f = open('data.pkl','wb')
pickle.dump(data,f)
f.close()
import pickle
f = open('data.pkl','rb')
read_data = pickle.load(f)
f.close()
本文标题:pickle保存变量
本文链接:https://www.haomeiwen.com/subject/bwdkiqtx.html
网友评论