ranjan das wrote:
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
Another syntax error. Please ensure that you test your code before
posting. In this case, it's eas
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