Answers for "how to loop through a nested dictionary in python"

2

python iterate over multidimensional dictionary

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

for i in d.keys():
    print(i)
    for j in d[i].keys():
        print(j)
Posted by: Guest on July-13-2021

Code answers related to "how to loop through a nested dictionary in python"

Python Answers by Framework

Browse Popular Code Answers by Language