# Define a dictionary my_dict = { "key1": "value1", "key2": "value2", "key3": "value3" } # Iterate over the dictionary using the items() method for key, value in my_dict.items(): # Print the key and value for each pair print(key, value)
key1 value1
key2 value2
key3 value3
Learn Flask development and learn to build cool apps with our premium Python course on Udemy.