[Tutor] Sorting a list of list
Laura Creighton
lac at openend.se
Sat Jun 6 03:54:56 CEST 2015
In a message of Fri, 05 Jun 2015 21:16:33 +0100, Stephen Nelson-Smith writes:
>As part of my league secretary program (to which thread I shall reply again
>shortly), I need to sort a list of lists. I've worked out that I can use
>sorted() and operator.itemgetter to sort by a value at a known position in
>each list. Is it possible to do this at a secondary level? So if the
>items are the same, we use the secondary key?
Certainly. see: https://wiki.python.org/moin/HowTo/Sorting
Laura
More information about the Tutor
mailing list