📜  python sort dict by key - Python代码示例

📅  最后修改于: 2022-03-11 14:47:20.493000             🧑  作者: 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