python的sort有个key参数
摘要:
>>> a=range(10)>>> b=a[::-1]>>> a[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>> b[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]>>> c=zip(a,b)>>> c[(0, 9), (1, 8), (2, 7), (3, 6), (4, 5), (5, 4), (6, 3), (7, 2), (8, 1), (9, 0)]>>> c.sort(key=lambda x:x[0])>>> 阅读全文