A beginner Python/programming question... I\'d like to build a tree structure in Python, preferably based on dictionaries. I found code that does this neatly:
This
root['toplevel']['secondlevel']['thirdlevel'] = 1
can also be done like this:
node = root for key in ('toplevel', 'secondlevel'): node = node[key] node['thirdlevel'] = 1
I hope that gives you an idea.