array = [{"age":20,"name":"a"},{"age":25,"name":"b"},{"age":10,"name":"c"}]
array = sorted(array,key=lambda x:x["age"])
print(array)

https://www.runoob.com/python3/python3-func-sorted.html

array = [[3,55,18],[2,265,162],[2,25,102]]
sorted(array,key=lambda x:x[2],reverse=True)

 

发表评论

邮箱地址不会被公开。 必填项已用*标注