[Tutor] idiomatic way of merging two dictionaries

Amit Sethi amit.pureenergy at gmail.com
Wed Nov 4 07:49:02 CET 2009


Hi , I am trying to merge(I am not sure if that is the right term)
dictionaries like this

dict1 ={'a':4,'b':3,'v':7,'h':4}
dict2={'a':5,'v':4,'k':3}
dict3 would be {'a':[4,5],'b':[3,4],'v':[7,4],'k':[0,3],'h':[4,0]}

-- 
A-M-I-T S|S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091104/d4617228/attachment.htm>


More information about the Tutor mailing list