Python: Loop over a dictionary
A short, tested Python example for loop over a dictionary. Copy it and adjust the names and paths for your project.
Python
d = {"a": 1, "b": 2}
for key, value in d.items():
print(key, value)
for key in d: # keys only
print(key)Find it in Zest
Search for “python loop over a dictionary” in Zest and this example appears above the results, with other matches to choose from. Searches stay private.