You can use comprehension dictto scroll through the keys, and then subtract the corresponding values from each original dict.
>>> a = {'a': 5, 'b': 3, 'c': 12}
>>> b = {'a': 1, 'b': 7, 'c': 19}
>>> {k: b[k] - a[k] for k in a}
{'a': -4, 'b': 4, 'c': 7}
This assumes that both dicthave the same keys. Otherwise, you will have to think about what behavior you expect if there are keys in one dict, but not in the other (maybe some default value?)
, ,
>>> {k: b[k] - a[k] for k in a.keys() & b.keys()}
{'a': -4, 'b': 4, 'c': 7}