I have a nested python dictionary data structure. I want to read its keys and values without using collection module. The data structu
python dictionary
without
collection
you can iterate all keys and values of nested dictionary as following:
d = {'dict1': {'foo': 1, 'bar': 2}, 'dict2': {'baz': 3, 'quux': 4}} for i in d: for j, k in d[i].items(): print(j,"->", k)
Your output looks like this -
foo -> 1 bar -> 2 baz -> 3 quux -> 4