Sorting of list containing tuples

Paul Rubin http
Thu May 18 21:38:55 CEST 2006

Ronny Mandal <ronnyma at> writes:
> 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)]

sorted(l, key = lambda a: -a[1])

More information about the Python-list mailing list