In message <[EMAIL PROTECTED]>, Abandoned
wrote:
> 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}
Don't people like one-liners? :)
dict((k, dict1.get(k, 0)
On Oct 4, 4:35 pm, Gary Coulbourne <[EMAIL PROTECTED]> wrote:
> >>> dict1={1: 4, 3: 5}... and 2 millions element
> >>> dict2={3: 3, 8: 6}... and 3 millions element
>
> If you don't mind doing some kind of lazy evaluation, you could do
> something like...
>
> --
> dict1
>>> dict1={1: 4, 3: 5}... and 2 millions element
>>> dict2={3: 3, 8: 6}... and 3 millions element
If you don't mind doing some kind of lazy evaluation, you could do
something like...
--
dict1={1:4, 3:5}
dict2={3:3, 8:6}
import UserDict
class Merge(UserDict.DictMixi
On Oct 1, 2:01 pm, Abandoned <[EMAIL PROTECTED]> wrote:
> 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}
Unless you have some prior knowledge about the dicts
>> 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}
>
> Well not sure how this will work with 5+ million elements, but here's
> one stab at it:
>
> >>> dict1
Abandoned wrote:
> On 1 Ekim, 20:41, Carsten Haese <[EMAIL PROTECTED]> 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
Abandoned a écrit :
>
> I'm sorry my bed english.
Time to go to bad, then !-)
(sorry, couldn't resist)
--
http://mail.python.org/mailman/listinfo/python-list
On 1 Ekim, 20:41, Carsten Haese <[EMAIL PROTECTED]> 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
>
On Oct 1, 10:24 am, Abandoned <[EMAIL PROTECTED]> 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.
The dict.update approach is the fastest
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 a
> 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.
If you combine your dict1 and dict2 to become result_dict, what
should the result of result_dict[3] b
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 rega
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..
--
http://mail.python.org/mailman/listinfo/python-list
13 matches
Mail list logo