How to Access Items of a Dictionary in Python


In this example we will show how to access the items of a dictionary by get() function in Python.

Source Code

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

a = mydict.get('name')
print(a)

Output:

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