Possible Duplicate:
Get first N key pairs from an Ordered Dictionary to another one in python
I have a large dictionary. How do I sort those entries in decreasing order and then print the first n items? To print the sorted items in dictionary, I am using this code:
print sorted(mydictionary.iteritems(), key=operator.itemgetter(1), reverse=True)
You can print a slice then: