how do I sort dictionaries by value then by key

时间:2015-06-15 14:59:58

标签: python python-2.7 sorting dictionary

I have a dictionary with integers for both keys and values

d = {25:5, 12:45, 34:5, 19:5, 209:3, 12:7, 1:999, 999:1}

Is there a method to return

>>> print d
{999:1, 209:3, 19:5, 25:5, 34:5, 12:7, 12:45, 1,999}

0 个答案:

没有答案