>>> from operator import itemgetter
>>> ul = [(10,2),(9,4),(10,3),(10,4),(9,1),(9,3)]
>>> ol = sorted(ul, key=itemgetter(0,1), reverse=True)
>>> ol
[(10, 4), (10, 3), (10, 2), (9, 4), (9, 3), (9, 1)]
我想要的是在第二个键上对 reverse=False 进行排序。换句话说,我希望结果是:
[(10, 2), (10, 3), (10, 4), (9, 1), (9, 3), (9, 4)]
我该怎么做呢?