I'm trying to figure out how I can reference nested dict keys as a variable. For example, I have a nested dict of type:
example = {'a': {'b': 'hi'}, 'c': 1}
I would like to do something like:
keys = ['c', ['a','b']]
for key in keys:
print(example[key])
Output I would expect:
1
hi