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']
相關文章
相關標籤/搜索