import collections # 使用时就当作普通dict使用就行 res = collections.OrderedDict({}) 踩坑,python2字典是无序的,python3没有这个问题因为存储策略不同