On Sat, Feb 8, 2014 at 7:25 PM, Igor Korot <ikoro...@gmail.com> wrote: >> Try this: >> >> sorted_items = sorted(my_dict.keys(), key=my_dict.get) >> for key in sorted_items: >> print my_dict[key], key > > > This code fail. > sorted_item is a list of tuples. And so iterating the list in the for loop I > will get a tuple. > It probably should be: > > for key[1] in sorted_items: > > Let me try that. >
Actually, it's a list of keys - notice that I changed my_dict.items() into my_dict.keys()? ChrisA -- https://mail.python.org/mailman/listinfo/python-list