导入数据到obj.pkl文件
try:
import cPickle as Pickle
except ImportError:
import pickle as Pickle
outfile = open("obj.pkl","wb")
data = {"a":"aaaaa"}
Pickle.dump(data, outfile)
outfile.close()
读取数据
try:
import cPickle as Pickle
except ImportError:
import pickle as Pickle
readfile = open("obj.pkl", "rb")
a = Pickle.load(readfile)
print a
readfile.close()

浙公网安备 33010602011771号