python 排序函数的使用

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

效果
这里写图片描述

参考
https://www.cnblogs.com/koujiaodahan/p/8047109.html

猜你喜欢

转载自blog.csdn.net/Canhui_WANG/article/details/81152144