Python高级编程-如何让字典保持有序?

d=[]
d['jim']=(1,40)
d['len']=(2,45)
d['zil']=(3,49)
for k in d:print k
.......
from collections import OrderedDict
d= OrderedDict()
d['jim']=(1,40)
d['len']=(2,45)
d['zil']=(3,49)
for k in d:print k
.........

你可能感兴趣的:(Python高级编程)