Dictionaries

Simon Brunning simon at brunningonline.net
Wed Oct 18 11:30:19 EDT 2006


On 18 Oct 2006 08:24:27 -0700, Lad <python at hope.cz> wrote:
> How can I add two dictionaries into one?
> E.g.
> a={'a:1}
> b={'b':2}
>
> I need
>
> the result {'a':1,'b':2}.

>>> a={'a':1}
>>> b={'b':2}
>>> a.update(b)
>>> a
{'a': 1, 'b': 2}

-- 
Cheers,
Simon B
simon at brunningonline.net
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list