Add two dicts

Erik Max Francis max at alcyone.com
Fri Aug 29 01:07:06 EDT 2003


Afanasiy wrote:

> Can I add two dicts in a way which is not cumbersome to the above %
> string
> operation? Is this another case of writing my own function, or does a
> builtin (or similar) already exist for this?

	combinedDict = aDict.copy()
	combinedDict.update(anotherDict)

If that's cumbersome, don't really know what you'd consider
non-cumbersome.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ The revolution will not televised
\__/  Public Enemy




More information about the Python-list mailing list