python 给字典按值排序,同样适合于其他

sorted_items = sorted(dico.items(),key=lambda x:(-x[1],x[0]))

  

多思考也是一种努力,做出正确的分析和选择,因为我们的时间和精力都有限,所以把时间花在更有价值的地方。
原文地址:https://www.cnblogs.com/LiuXinyu12378/p/12416728.html