How to update value in dictionary?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
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

Bye,
bearophile



More information about the Python-list mailing list