>>> from operator import itemgetter
>>> l = [(1.23, 'Smith'), (2.34, 'Jones'), (3.45, 'de la Smith')]
>>> ol = sorted(l, key=itemgetter(1))
>>> ol
[(2.34, 'Jones'), (1.23, 'Smith'), (3.45, 'de la Smith')]
如何使用多个列表推导获得以下列表而不会产生一些混乱?
[(3.45, 'de la Smith'), (2.34, 'Jones'), (1.23, 'Smith')]