nested_dict = lambda : collections.defaultdict(nested_dict)
d = nested_dict()
d[1][2][3] = 'Hello, dictionary!'
print(d[1][2][3])
How can I get Python to automatically create missing key/value pairs in a dictionary?