Gehen Sie verschachteltes Diktierpython

from benedict import benedict

d = benedict({'dict1': {'foo': 1, 'bar': 2}, 'dict2': {'baz': 3, 'quux': 4}})

def traverse_item(dct, key, value):
   print('key: {} - value: {}'.format(key, value))

d.traverse(traverse_item)
SuperCode Gnertic