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) + dict2.get(k, 0))
for k in dict1.keys() + dict2.keys())
--
http://mail.python.org/mailman/listinfo/python-list
