Sorting a set works, sorting a dictionary fails ?

Νικόλαος Κούρας nikos.gr33k at gmail.com
Mon Jun 10 04:16:37 EDT 2013


What if i wanted to sort it out if alphabetically and not by the values?

Thsi worked:

for item in sorted(months.items(),key=lambda num : num[1]):

but this failed:

for item in sorted(months.items()):

why?



More information about the Python-list mailing list