how to join two Dictionary together?
Roy Smith
roy at panix.com
Tue Aug 30 11:22:10 EDT 2005
In article <1125413088.326703.64590 at g43g2000cwa.googlegroups.com>,
DENG <polytechnique at gmail.com> wrote:
>
>dict1={...something...}
>
>dict2={...somethind else ..}
>
>dict1 + dict2
>
>
>that's does works ..:(, it's not like List...
>
>
>anyone can tell me how to get it?
>
>thanks in advance
First, you have to tell us what you want to happen when the two
dictionaries have overlapping keys. Let's say I have:
d1 = {1: 'one', 2: 'two'}
d2 = {1: 'uno', 3: 'tres'}
if I do d3 = addDicts (d1, d2), what do you want d3 to have in it?
More specifically, what do you want the value of d3[1] to be?
More information about the Python-list
mailing list