import _pickle as cPickle
#将data导出到本地,导出的文件名为【第四章data】,文件类型为pkl
cPickle.dump(data,open("第四章data.pkl","wb"))
#将"第四章data.pkl"从本地导回来,导入后的名字是data_import
data_import = cPickle.load(open("第四章data.pkl","rb"))
Python数据文件导出到本地并导回的代码(cPickle)
于 2022-02-02 20:31:04 首次发布