Let's say I have two dictionaries:
dict1 = {"name": "", "full_name": {"first_name": "", "last_name": ""}}
dict2 = {"name": "JD", "full_name": {"first_name": "John", "last_name": "Doe"}, "filled_key": "something", "unfilled_key": ""}
I would like to merge them so that dict1's keys contains all the values from dict2's keys. However, it should not include empty keys from dict2. Something like this should be the output:
merged = {"name": "JD", "full_name": {"first_name": "John", "last_name": "Doe"}, "filled_key": "something"}
I was able to merge them like follows:
merged = {**dict1, **dict2}
but this also copies over the empty keys from dict2. Any idea on how this can be achieved without copying over empty keys?