I have a following dictionary :
{2009: [12, 11, 10, 9], 2010: [1]}
I'm trying to reverse-sort it, so that 2010 comes first. Here's the code :
def dictSort(dict):
items = dict.items()
items.sort(reverse=True)
dict = {}
for item in items:
dict[item[0]] = item[1]
return dict
But in return I get the same dictionary. Until the for loop everything looks fine. Why is that ?