python列表嵌套字典的排序 python列表嵌套字典排序?

python列表嵌套字典排序?L=[{“status”:1,“com”:“a”},{“status”:2,“com”:“C”},{“status”:1,“com”:“B”},{“status”:1,“

python列表嵌套字典排序?

L=[{“status”:1,“com”:“a”},{“status”:2,“com”:“C”},{“status”:1,“com”:“B”},{“status”:1,“com”:“a”}L.sort(key=lambda x:(-x[“status”],x[“com”])print L

Python的列表提供了一种排序方法,它还可以使用Python的内置排序来获取新的排序列表。

示例:

a=[1,3,2

]打印(排序(a))

a.排序()

打印(a)