📜  排序字典 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:17             🧑  作者: Mango

代码示例6
#for dictionary d
sorted(d.items(), key=lambda x: x[1]) #for inceasing order
sorted(d.items(), key=lambda x: x[1], reverse=True) # for decreasing order
#it will return list of key value pair tuples