Skip to content

Loop over Dictionary Items

Using for loop

You can loop over a dictionary using a for

looping over dictionary items
my_dict = {"one": 1, "two": 2}
for key, value in my_dict.items():
print(key, value)
# --------------output--------------
# ("one", 1)
# ("two", 2)