python 字典排序(值排序),并返回key序列

a = {"a":1, "c":2, "b":3, "d":0} b = a.keys() b.sort( key = a.__getitem__ ) print b 结果: ['d', 'a', 'c', 'b']
相关文章
相关标签/搜索