If I have 2 dicts as follows:
d1 = {(\'unit1\',\'test1\'):2,(\'unit1\',\'test2\'):4} d2 = {(\'unit1\',\'test1\'):2,(\'unit1\',\'test2\'):\'\'}
In case when you have dictionaries with the same size and keys you can use the following code:
dict((k,v if k in d2 and d2[k] in [None, ''] else d2[k]) for k,v in d1.iteritems())