Combine two dictionary...

Abandoned besturk at gmail.com
Mon Oct 1 14:01:30 EDT 2007


On 1 Ekim, 20:41, Carsten Haese <cars... at uniqsys.com> wrote:
> On Mon, 2007-10-01 at 10:24 -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.
>
> You'll have to be a bit more precise here about how and where you want
> to "combine". Should the result be a new dictionary or should it replace
> one of dict1 or dict2? You're also not saying how you want conflicts
> between dict1 and dict2 should be resolved. For example, both dict1 and
> dict2 say something about the key 3. One says 5, the other says 3.
> Should the combined dict say 3 or 5 or (3,5) or maybe even 4?
>
> Also, based on your earlier posts from today, I'm wondering if those
> dicts come from executing SQL queries. If so, you might want to consider
> combining the results in SQL (using a UNION query) instead of combining
> them in Python.
>
> --
> Carsten Haesehttp://informixdb.sourceforge.net

I want to total score..
For example
> > dict1={1: 4,  3: 5}... and 2 millions element
> > dict2={3: 3,  8: 6}... and 3 millions element

result should be dict3={1:4, 3:8, 8:6}




More information about the Python-list mailing list