another way to sort like l.sort(key=lambda x:(x, -x))
__peter__ at web.de
Tue Sep 7 16:03:44 CEST 2010
> i need to implement l.sort(key=lambda x:(x, -x)) in
> another way .I want to know what the modification needed in the 'if'
> check to sort this list of tuples in k ascending and k
It seems you are not getting any closer to your goal. Perhaps it would help
if you could explain that goal clearly rather than describing the means you
are employing to achieve it.
> I have a list of tuples.
> l = [((30,50),(70)), ((50,20),(20))]
By the way, (42) is not a tuple, it's an integer. To turn it into a 1-tuple
you have to add a ',':
More information about the Python-list