dict1 = { 'a':22, 'f':2, 'H':99, 'zz':56 } print(sorted(dict1.items(),key= lambda k : k[1])) print(sorted(zip(dict1.values(),dict1.keys())))
[('f', 2), ('a', 22), ('zz', 56), ('H', 99)] [(2, 'f'), (22, 'a'), (56, 'zz'), (99, 'H')]
https://blog.csdn.net/weixin_44038167/article/details/103624245