top values from dictionary

Viewed 60255

How do I retrive the top 3 list from a dictionary?

>>> d
{'a': 2, 'and': 23, 'this': 14, 'only.': 21, 'is': 2, 'work': 2, 'will': 2, 'as': 2, 'test': 4}

Expected result:

and: 23
only: 21
this: 14
4 Answers
Related