In this example we will show 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
In this example we will show how to access the items of a dictionary by referring to its key name in Python
mydict = {
'name': 'Steven',
'age': 24,
'ID': 123456
}
a = mydict['name']
print(a)
Output:
Steven