1. OrderedDict 有序字典 OrderedDict是dict的子类,它记住了内容添加的顺序.比较时,OrderedDict要内容和顺序完全相同才会视为相等 import collections d = collections.OrderedDict() d[3] = 'A' d[2] = 'B' d[1] = 'C' for k, v in d.items(): print k, v 2.读取json串时如何保持原有顺序 import json from collections im