I have two dicts:
a = {'a': 1, 'b': 2, 'c': 3}
b = {'a': 2, 'd': 4, 'c': 5}
and I want to get:
{'a': 2, 'b': 2, 'c': 5}
I used {**a, **b}
but it return:
{'a': 2, 'b': 2, 'c': 5, 'd': 4}
How to exclude keys from b
which are not in a
using the simplest and fastest way.
I am using python 3.7.