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

thebjorn BjornSteinarFjeldPettersen at gmail.com
Mon Feb 11 08:04:53 EST 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