Is there an easy way to sort a list by two criteria?

thebjorn BjornSteinarFjeldPettersen at gmail.com
Mon Feb 11 14:04:53 CET 2008


On Feb 11, 10:47 am, bearophileH... at lycos.com wrote:
[...]
> A little known thing from Python 2.5:
[...]
> >>> sorted(lst, key=itemgetter(2, 1))

Cute, thanks :-)

--bjorn



More information about the Python-list mailing list