defaultdict

Useful for counts, grouped lists, etc.

from collections import defaultdict
d = defaultdict(list)
d['a'].append(1)  # no KeyError