使用Python对二维列表/数组进行排序
在Python中,可以使用sorted函数对二维数组进行排序,如:
students = [[‘Maride’,13,2],[‘John’,15,6],[‘Lucy’,14,4]]
#可以使用如下语句针对某一列进行排序,如对第三列进行排序
students.sort(key = lambda student:student[2])
#也可以采用如下语句,功能是一样的
students = sorted(students, key =lambda student:student[2])