How to join 2 lists of dicts in python?

You should accumulate the results in a dictionary. You should use the values of 'a' and 'b' to form a key of this dictionary

Here, I have used a defaultdict to accumulate the entries

l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]

from collections import defaultdict
D = defaultdict(dict)
for lst in l1, l2:
    for item in lst:
        key = item['a'], item['b']
        D[key].update(item)

l3 = D.values()
print l3

output:

[{'a': 1, 'c': 3, 'b': 2, 'e': 101, 'd': 4}, {'a': 5, 'c': 7, 'b': 6, 'e': 100, 'd': 8}]

Simple list operations would do the thing for you as well:

l1 = [{'a': 1, 'b': 2, 'c': 3, 'd': 4}, {'a': 5, 'b': 6, 'c': 7, 'd': 8}]
l2 = [{'a': 5, 'b': 6, 'e': 100}, {'a': 1, 'b': 2, 'e': 101}]
l3 = []

for i in range(len(l1)):
    for j in range(len(l2)):
        if l1[i]['a'] == l2[j]['a'] and l1[i]['b'] == l2[j]['b']:
            l3.append(dict(l1[i]))
            l3[i].update(l2[j])