Is there a way to see how many items in a dictionary share the same value in Python?
Let\'s say that I have a dictionary like:
{\"a\": 600, \"b\": 75
When Python 2.7 comes out you can use its collections.Counter class
otherwise see counter receipe
Under Python 2.7a3
from collections import Counter items = {"a": 600, "b": 75, "c": 75, "d": 90} c = Counter( items ) print( dict( c.items() ) )
output is
{600: 1, 90: 1, 75: 2}