You can do

orig.update(extra)

or, if you don't want orig to be modified, make a copy first:

dest = dict(orig)  # or orig.copy()
dest.update(extra)

Note that if extra and orig have overlapping keys, the final value will be taken from extra. For example,

>>> d1 = {1: 1, 2: 2}
>>> d2 = {2: 'ha!', 3: 3}
>>> d1.update(d2)
>>> d1
{1: 1, 2: 'ha!', 3: 3}
Answer from mipadi on Stack Overflow
🌐
DataCamp
datacamp.com › tutorial › python-dictionary-append
Python Dictionary Append: How to Add Key-Value Pairs | DataCamp
August 6, 2024 - Learn Python dictionary append techniques such as square bracket notation, the .update() method for bulk additions, and .setdefault() for conditional inserts.
Discussions

Looping through Dictionary and add items to second dictionary
I am trying to loop through a dictionary and add values that satisfy my true statemen to a second dictionary At the moment, all I want to do is check and see if the value of each element is already a key in the entire dictionary and if so add it, otherwise go to next mydict={“John” : ... More on discuss.python.org
🌐 discuss.python.org
0
September 25, 2022
How to append two dictionaries so they dont overwrite each other?
Create a list and append the resulting dict there, no need to update the same dict over and over More on reddit.com
🌐 r/learnpython
13
5
February 16, 2023
How can I Python dictionary add a new key to an existing dictionary? - TestMu AI Community
How can I Python dictionary add a new key to an existing dictionary? I know dictionaries don’t have an .add() method, so what is the proper way to add a new key-value pair? More on community.testmuai.com
🌐 community.testmuai.com
0
December 17, 2024
Python dictionary in to html table
Answer link : https://codehunter.cc/a/flask/python-dictionary-in-to-html-table ... Be the first to share what you think! ... Single ErrorDocument directive to catch all errors... ... Form submit with AJAX passing form data to PHP without... ... How to add comment in apache httpd.conf not as ... More on reddit.com
🌐 r/codehunter
1
🌐
W3Schools
w3schools.com › python › python_dictionaries_add.asp
Python - Add Dictionary Items
Python Sets Access Set Items Add Set Items Remove Set Items Loop Sets Join Sets Frozenset Set Methods Set Exercises Code Challenge Python Dictionaries
🌐
Great Learning
mygreatlearning.com › blog › it/software development › python dictionary append: how to add key/value pair?
Python Dictionary Append: How To Add Key/Value Pair?
October 14, 2024 - Yes, you can. When you use the update() method to append dictionary python, existing keys are updated with new values, but if there are any new keys, they are added to the dictionary without overwriting existing ones.
🌐
Python documentation
docs.python.org › 3 › tutorial › datastructures.html
5. Data Structures — Python 3.14.3 documentation
It is best to think of a dictionary as a set of key: value pairs, with the requirement that the keys are unique (within one dictionary). A pair of braces creates an empty dictionary: {}. Placing a comma-separated list of key:value pairs within the braces adds initial key:value pairs to the dictionary; this is also the way dictionaries are written on output.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-dictionary
How to Add and Update Python Dictionaries Easily | DigitalOcean
October 16, 2025 - However, dictionary keys are immutable and need to be unique within each dictionary. This makes dictionaries highly efficient for lookups, insertions, and deletions. Dictionaries are widely used in Python for various applications such as counting occurrences, grouping data, and storing configurations. Despite their versatility, there’s no built-in add method for dictionaries.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-nested-dictionary
Python Nested Dictionary - GeeksforGeeks
July 12, 2025 - This example creates a nested dictionary to store details of multiple students. Each student is added as a key and their information (name, age, grade) is stored in an inner dictionary.
Find elsewhere
🌐
Career Karma
careerkarma.com › blog › python › python add to dictionary: a guide
Python Add to Dictionary: A Guide | Career Karma
December 1, 2023 - Instead, you add an item to a dictionary by inserting a new index key into the dictionary, then assigning it a particular value. This tutorial discussed, with an example, how to add an item to a Python dictionary.
🌐
Codecademy
codecademy.com › article › python-dictionary-append-how-to-add-items-to-dictionary
Python Dictionary Append: How to Add Items to Dictionary | Codecademy
The most direct and commonly used way to add or update items in a Python dictionary is by using square brackets ([]) with the assignment operator (=). This method allows you to assign a value to a new key or update the value of an existing key.
🌐
Python.org
discuss.python.org › python help
Looping through Dictionary and add items to second dictionary - Python Help - Discussions on Python.org
September 25, 2022 - I am trying to loop through a dictionary and add values that satisfy my true statemen to a second dictionary At the moment, all I want to do is check and see if the value of each element is already a key in the entire dictionary and if so add it, otherwise go to next mydict={“John” : “House”, “Eric” : “Turtle”, “Jimmy” : “John”, “Charles” : “Eric”} myresult={“Jimmy” : “John”, “Charles” : Eric"} ← these two satisfy the true statement of the value being a key in the dictionary (i.e. value “Jo...
🌐
Reddit
reddit.com › r/learnpython › how to append two dictionaries so they dont overwrite each other?
r/learnpython on Reddit: How to append two dictionaries so they dont overwrite each other?
February 16, 2023 -

I have a script that continuosly generates dictionaries with the same keys but different values. I want to write the results out in a json file but to do that i need to do load & dump into the file.

with open('sample.json') as f:
    data = json.load(f)

data.update(results)

with open('sample.json', 'w') as f:
    json.dump(data, f)

The above code only overwrites the existing data it doesn't append it. I figured it is beacuse the dictionaries have the same keys because if i try it with a different dictionary template, the append does happen.

Is there a way to append similar dictionaries without overwriting?

🌐
JanBask Training
janbasktraining.com › community › python-python › append-a-dictionary-to-a-dictionary
Append a dictionary to a dictionary | JanBask Training Community
May 12, 2025 - Appending one dictionary to another in Python is commonly done when you want to combine or update key-value pairs. While Python dictionaries don’t have a direct “append” method like lists, you can merge them using a few simple approaches. ... dict1 = {'a': 1, 'b': 2} dict2 = {'c': 3, 'd': 4} dict1.update(dict2) print(dict1) # {'a': 1, 'b': 2, 'c': 3, 'd': 4} update() adds all key-value pairs from dict2 to dict1.
🌐
Note.nkmk.me
note.nkmk.me › home › python
Add and Update an Item in a Dictionary in Python | note.nkmk.me
August 25, 2023 - This article explains how to add an item (key-value pair) to a dictionary (dict) or update the value of an existing item in Python. Add or update a single item in a dictionary Add or update multiple i ...
🌐
PhoenixNAP
phoenixnap.com › home › kb › devops and development › python: how to add items to dictionary
Python: How to Add Items to Dictionary
December 22, 2025 - Learn how to add items to a Python dictionary in this guide through example code. See how you can add multiple items at once through loops.
🌐
Analytics Vidhya
analyticsvidhya.com › home › 5 methods to add new keys to a dictionary in python
5 Methods to Add New Keys to a Dictionary in Python
February 7, 2025 - Understand the differences between the available methods for adding keys to dictionaries and their appropriate use cases. Explore practical examples demonstrating adding and manipulating key-value pairs in Python dictionaries.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-dictionary
Python Dictionary - GeeksforGeeks
... d = { "name": "Kat", 1: "Python", (1, 2): [1,2,4] } # Access using key print(d["name"]) # Access using get() print(d.get("name")) ... New items are added to a dictionary using the assignment operator (=) by giving a new key a value.
Published   January 15, 2026
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › append python dictionary to dictionary
Append Python Dictionary to Dictionary - Spark By {Examples}
May 31, 2024 - Python provides an update() method in dict class that can be used to append a new dictionary at the ending point of the given dictionary. The update() method allows the dictionary as an argument and adds its key-value pairs to the original ...
🌐
freeCodeCamp
freecodecamp.org › news › python-add-to-dictionary-adding-an-item-to-a-dict
Python Add to Dictionary – Adding an Item to a Dict
March 15, 2022 - Python has built-in data structures like Lists, Sets, Tuples and Dictionaries. Each of these structures have their own syntax and methods for interacting with the data stored. In this article, we'll talk about Dictionaries, their features, and how to add items to them.
🌐
TestMu AI Community
community.testmuai.com › ask a question
How can I Python dictionary add a new key to an existing dictionary? - TestMu AI Community
December 17, 2024 - How can I Python dictionary add a new key to an existing dictionary? I know dictionaries don’t have an .add() method, so what is the proper way to add a new key-value pair?
🌐
Quora
quora.com › How-do-you-append-one-dictionary-to-another-in-Python
How to append one dictionary to another in Python - Quora
Answer (1 of 3): Appending Values to a Dictionary: We can add new elements to an existing dictionary, extend it with single pair of values or join two dictionaries into one. If you want to add only one element to the dictionary, then you should use the following method. Syntax : Method 1 (singl...