Combining entries, filtering of Python dictionaries

Posted by matt on Stack Overflow See other posts from Stack Overflow or by matt
Published on 2010-05-20T07:44:25Z Indexed on 2010/05/20 8:50 UTC
Read the original article Hit count: 193

Filed under:
|
|
|

I have two large lists that are filled with dictionaries. I need to combine the entries if a value from dict2==dict1 and place the newly combined matches somewhere else. I'm having trouble explaining it.

List one contains:

{'keyword':value, 'keyword2':value2}

List two:

{'keyword2':value2, 'keyword3':value3}

I want a new list with dictionaries including keyword1, keyword2, and keyword3 if both lists share the same 'keyword2' value. What's the best way to do this? When I try, I only come up with tons of nested for loops. Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about dictionaries