python的几种序列化方式

结论: performance: marshal > cPickle > json > pickle   >>> timeit.timeit("pickle.dumps([1,2,3])","import pickle",number=10000) 0.2939901351928711 >>> timeit.timeit("json.dumps([1,2,3])","import json",number=10000) 0.09756112098693848 >>> timeit.timeit("pickle.dumps([1,2,3])","import cPickle as pickle",number=10000) 0.031056880950927734 >>> timeit.timeit("marshal.dumps([1,2,3])","import marshal", number=10000) 0.00703883171081543   引自:https://*.com/questions/9662757/python-performance-comparison-of-using-pickle-or-marshal-and-using-re    
上一篇:408. Valid Word Abbreviation


下一篇:Python中格式化字符串更酷的方式