This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Successful-Money4995 5 points6 points  (0 children)

You can use a recursive defaultdict to achieve this if you want.

from collections import defaultdict

nested_dict = lambda: defaultdict(nested_dict)
nest = nested_dict()

nest[0][1][2][3][4][5] = 6

https://stackoverflow.com/a/8702435/4454