Combine two dictionary...
Stargaming
stargaming at gmail.com
Mon Oct 1 13:34:17 EDT 2007
On Mon, 01 Oct 2007 10:24:39 -0700, Abandoned wrote:
> Hi..
> dict1={1: 4, 3: 5}... and 2 millions element dict2={3: 3, 8: 6}... and
> 3 millions element
>
> I want to combine dict1 and dict2 and i don't want to use FOR because i
> need to performance.
>
> I'm sorry my bed english.
> King regards..
If mutation of one dict is okay, use the `update` method. As in::
dict1.update(dict2) # will update dict1 with dict2's items
Create a copy of one dictionary if you do not want to mutate them.
See http://docs.python.org/lib/typesmapping.html#l2h-294 for details.
More information about the Python-list
mailing list