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))
2024-02-15 23:40:40
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))
下一篇:MD5 工具类