Dictionary Keys, Values, and Items in Python


Iterate over keys, values, or key-value pairs in a dictionary.

Source Code

my_dict = {"name": "Alice", "age": 25}
print(my_dict.keys())
print(my_dict.values())
print(my_dict.items())
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments