How to Change Value of a Specific Item in Python


In this example we will show how to change the value of a specific item by referring to its key name in Python.

Source Code

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

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

Output:

{'name': 'Jim', 'age': 24, 'ID': 123456}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments