I have two dictionaries:
first = {"phone": {
"home": "(234) 442-4424"
},
"address":"xyz"
}
second = {"phone": {
"home": "(234) 442-4424",
"home1": "(234) 442-4424"
},
"address":{}
}
I want merge two dictionaries first over second, meaning the first dictionary doesn't lose its previous values and only the missing key values are added into first.
The final dictionary should look like this:
final = {"phone": {
"home": "(234) 442-4424",
"home1": "(234) 442-4424"
},
"address":"xyz"
}
Also what if when we use list of dictionaries like : -
first = {"phone": {
"home": "(234) 442-4424"
},
"address":[{"home":""},{"office":""}]
}