有时候,取值得到一个字典,然后想根据字典的value进行排序

>data = {'a':1, 'c':3, 'b':2}
>result=sorted(data.items(),key=lambda x:x[1],reverse=False)
>print result
>[('a', 1), ('b', 2), ('c', 3)]

 

相关文章:

  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
猜你喜欢
  • 2022-02-01
  • 2022-12-23
  • 2021-09-29
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案