Python Change Values in a Dictionary


Change Values in a Dictionary

You can change the value of a specific item by referring to its key name:

Example

Change the "year" to 2018:

thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
thisdict["year"] = 2018
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.