How to update value in dictionary?

Iain King iainking at gmail.com
Wed Aug 27 09:45:42 EDT 2008


On Aug 27, 2:40 pm, ssecorp <circularf... at gmail.com> wrote:
> dict.update({"a":1}) SETS the dict item "a" 's value to 1.
>
> i want to increase it by 1. isnt that possible in an easy way? I
> should use a tuple for this?

dict["a"] += 1

Iain



More information about the Python-list mailing list