Combining entries, filtering of Python dictionaries
- by matt
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