Sorting of list containing tuples

Ronny Mandal ronnyma at
Thu May 18 21:29:59 CEST 2006


Assume we have a list l, containing tuples t1,t2...

i.e. l = [(2,3),(3,2),(6,5)]

And now I want to sort l reverse by the second element in the tuple,
i.e the result should ideally be:

 l = [(6,5),(2,3),(3,2)]

Any ideas of how to accomplish this?


Ronny Mandal

More information about the Python-list mailing list