dict排序:
a={'A':4,'B':3,'C':2,'D':1}
sorted(a.iteritems(),key=operator.itemgetter(1),reverse=False)
#执行结果: [('D', 1), ('C', 2), ('B', 3), ('A', 4)]
dict排序:
a={'A':4,'B':3,'C':2,'D':1}
sorted(a.iteritems(),key=operator.itemgetter(1),reverse=False)
#执行结果: [('D', 1), ('C', 2), ('B', 3), ('A', 4)]