新浦京娱乐场官网Pickling and shelving data

2019-06-16 02:09栏目:技术创新

import cPickle, shelve

print 'Pickling lists.'
variety = ['sweet', 'hot', 'dill']
shape = ['whole', 'spear', 'chip']
brand = ['Claussen', 'Heinz', 'Vlassic']
f = open('pickles1.dat', 'w')
cPickle.dump(variety, f)
cPickle.dump(shape, f)
cPickle.dump(brand, f)
f.close()

print 'nUnpickling lists.'
f = open('pickles1.dat', 'r')
variety = cPickle.load(f)
shape = cPickle.load(f)
brand = cPickle.load(f)
print variety, 'n', shape, 'n', brand
f.close()

版权声明:本文由新浦京娱乐站_新浦京娱乐场官网_新浦京娱乐发布于技术创新,转载请注明出处:新浦京娱乐场官网Pickling and shelving data