d = {'a':1,'b':4,'c':2}
print(sorted(d.items(),key = lambda x:x[1],reverse = True))

 输出

[('b', 4), ('c', 2), ('a', 1)]

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2021-06-09
  • 2021-07-20
  • 2022-12-23
  • 2021-12-25
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2021-08-18
  • 2022-01-20
相关资源
相似解决方案