Using python 2.6:
I have a dictionary where each key contains a list of values.
I want to look at all the values in the dictionary and tally how many times each appears across all keys.
I have been looking at itervalues() or
for value in dictionary.values():
for a start, and also the .count() function, but I need to return a histogram.
for example:
print dictionary
would return
{'test' : ['spam', 'eggs', 'cheese', 'spam'], 'test2' : ['spam', 'cheese', 'goats']}
and I want something to tell me:
{'spam' : 3, 'eggs' : 1, 'cheese': 2, 'goats' : 1}