Dictionary Methods: keys(), values(), and items() in Python


Access elements of a dictionary.

Source Code

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