d = {'a':1,'b':4,'c':2}
方法一:
sorted(d.items(),key = lambda x:x[1],reverse = True)
方法二:
import operator sorted(d.items(),key = operator.itemgetter(1))
d = {'a':1,'b':4,'c':2}
方法一:
sorted(d.items(),key = lambda x:x[1],reverse = True)
方法二:
import operator sorted(d.items(),key = operator.itemgetter(1))