This is a small example i created
from operator import itemgetter
temp={'4':(2,3), '2':(5,8)}
print temp.items()
new_temp=sorted(temp.items(), key=itemgetter(1)
print new_temp
I want to sort the dictionary by the value in the first element of the tuple
((2,3) and (5,8)) and then the second value.
How do i do it? by setting key=itemgetter(1), it seems to sort the dict by
the first value of the tuple. But I am not able to do it for the second
value.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor