【python】msgpack使用
1.存储数据
import msgpack var={'a':'this','b':'is','c':'a test'} with open('file.name','wb') as f: msgpack.dump(var, f)
2.取出数据
import msgpack with open('file.name','rb') as f: var = msgpack.load(var, f) print var
此外:json, pickle都可以用于数据的序列化和存储