How to update value in dictionary?

bearophileHUGS at bearophileHUGS at
Wed Aug 27 16:43:46 CEST 2008

ssecorp wrote:
> dict.update({"a":1}) SETS the dict item "a" 's value to 1.

That works but it's not the right way to do that, use this:

d["a"] = 1


More information about the Python-list mailing list