How to Access Dictionary Item with Its Key Name in Python


In this example, we will learn how to access the items of a dictionary by referring to its key name in Python

Source Code

mydict = {
  'name': 'Steven',
  'age': 24,
  'ID': 123456
}

a = mydict['name']
print(a)

Output:

Steven
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement