import pickle class tick: name = '牛牛牛' age = 10 samp = [1,2,3,'aaa',[12,3],tick()] with open('te.xxxx','wb') as pickle_file: #序列化samp对象,以二进制的方式写到文件 pickle.dump(samp,pickle_file) ################################################## with open('te.xxxx','…
Programming Python, 3rd Edition 翻译 最新版本见:http://wiki.woodpecker.org.cn/moin/PP3eD 19.4. Pickled Objects 19.4. Pickle对象 Probably the biggest limitation of DBM keyed files is in what they can store: data stored under a key must be a simple text string.…