1. 排序函数sorted()调用
student_tuples = [
('john', 'A', 15),
('jane', 'B', 12),
('dave', 'B', 10),
]
student_tuples_sorted = sorted(student_tuples, key=lambda student: student[2])
print student_tuples_sorted
效果
1. 排序函数sorted()调用
student_tuples = [
('john', 'A', 15),
('jane', 'B', 12),
('dave', 'B', 10),
]
student_tuples_sorted = sorted(student_tuples, key=lambda student: student[2])
print student_tuples_sorted
效果