students=[
{"sno":111,"sname":"小玉","sgrade":55},
{"sno":202,"sname":"小红","sgrade":88},
{"sno":103,"sname":"小李","sgrade":99},
{"sno":104,"sname":"小张","sgrade":66}]
students_sort=sorted(students,key=lambda x:x["sgrade"],reverse=True)
print("排序前:")
print(students)
print("排序后:")
print(students_sort)
————————————————
版权声明:本文为CSDN博主「m0_73478516」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/m0_73478516/article/details/127478156
成绩排序s
最新推荐文章于 2024-08-23 15:54:50 发布