Let's say you have 2 dictionaries: dict1 and dict2.
You can merge dict2 inside dict1 using:
dict1.update(dict2.items())
update() method is used to add an item to a dictionary or to update an existing one items() method will get all items from a dictionary as (key, value) pairs
Keep in mind that a dictionary can't have a key more than once.
Let's say you have 2 dictionaries: dict1 and dict2.
You can merge dict2 inside dict1 using:
update() method is used to add an item to a dictionary or to update an existing one
items() method will get all items from a dictionary as (key, value) pairs
Keep in mind that a dictionary can't have a key more than once.