dict1 = {
}
dict2 = {
}
dict1.update(dict2)
update() Function dictionary dict2 Of key / value Yes, update to dict1 in .
dict1 = {
'Name': 'Jack', 'Age': 10}
dict2 = {
'Sex': 'boy' }
dict1.update(dict2)
print("Value : %s" % dict1)
#Value : {'Name': 'Jack', 'Age': 10, 'Sex': 'boy'}
use update Update Dictionary dict1, There will be two situations :
dict1 = {
1: 2, 2: 2}
dict2 = {
1: 1, 3: 3}
dict1.update(dict2)
print(dict1)
#{1: 1, 2: 2, 3: 3}