.items()
, .viewitems()
, and .iteritems()
work just like for dictionaries (and indeed, it seems like you printed out the value of .items()
). They give you a list/view/iterator over key-value pairs. For example, using a dictionary comprehension to get the mean value for each key:
>>> {k: sum(vals) / len(vals) for k, vals in the_defaultdict.viewitems()}