You are correct in that your list contains a reference to the original dictionary.

a.append(b.copy()) should do the trick.

Bear in mind that this makes a shallow copy. An alternative is to use copy.deepcopy(b), which makes a deep copy.

Answer from NPE on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ appending-a-dictionary-to-a-list-in-python
Appending a Dictionary to a List in Python - GeeksforGeeks
July 23, 2025 - Let's explore different ways in which we can append a dictionary to a list in Python. append() method is the most straightforward and simple way to append a dictionary to a list. ... a = [{'name': 'kate', 'age': 25}] b = {'name': 'Nikki', 'age': ...
Discussions

How do you add a list as the value of a key inside a dictionary? What about tuples of lists?
What is the difference between dict[key].append(list) and value.append(list)? They have the same result, yes, but the first is doing unnecessary work. The dict[key] part of the expression is fetching the value for the key, but you already have that in value, so just append to that. how would I add a second list to one of these values as a tuple? The value is a list, so just append whatever object you want. So if the object to append is a list just do: new_list = ['c', 'd'] for (key, value) ...: value.append(new_list) That's what you are already doing, so I'm not sure what your problem actually is. More on reddit.com
๐ŸŒ r/learnpython
8
2
April 3, 2022
python - How to add list elements into dictionary - Stack Overflow
Let's say I have dict = {'a': 1, 'b': 2'} and I also have a list = ['a', 'b, 'c', 'd', 'e']. Goal is to add the list elements into the dictionary and print out the new dict values along with the su... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Trying to insert a list inside the dictionary
Tiago Ramos is having issues with: Hi friends, I'm trying to insert this list inside the dictionary, this is the 3rd time I try. Please somebody show me how I do it, I wor... More on teamtreehouse.com
๐ŸŒ teamtreehouse.com
1
June 23, 2017
[Python 3] Add a value to a dictionary containing lists for each key, using a dict comprehension if the key already exists. Otherwise, if the key doesn't exist, create the key, value pair(value stored in list).

collections.defaultdict(list)?

More on reddit.com
๐ŸŒ r/learnpython
6
3
July 6, 2014
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ how do you add a list as the value of a key inside a dictionary? what about tuples of lists?
r/learnpython on Reddit: How do you add a list as the value of a key inside a dictionary? What about tuples of lists?
April 3, 2022 -

I am trying to add a list, or a tuple of lists, as the value to a key inside a dictionary. I'm starting with a dictionary that has empty lists as values, and then adding to the value of each key inside a loop like this:

dict = {'key1': [], 'key2': [], 'key3': []}
list = ['a', 'b']
for key,value in dict.items():
#    dict[key].append(list)
    value.append(list)
print(dict)

What is the difference between dict[key].append(list) and value.append(list)? They both produce the same dictionary when the other is commented out.

Further, how would I add a second list to one of these values as a tuple? Something like adding the list ['c', 'd'] to key2, like this:

{'key1': [['a', 'b']], 'key2': [['a', 'b'], ['c', 'd']], 'key3': [['a', 'b']]}

Thanks for any replies!

๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ appending-a-dictionary-to-a-list-in-python
Appending a dictionary to a list in Python
May 31, 2023 - There are other data types known as tuples and strings that belong to the sequence category. ... The elements should be quoted in double quotes and separated from each other using a comma. sample_list1 = ["List","Example","In","Python"] print(sample_list1) ... The Python dictionary may be thought of as an ordered collection of elements (starting with Python 3.7).
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ how to append dictionary to list in python?
How to Append Dictionary to List in Python? - Spark By {Examples}
May 31, 2024 - We can also use the dict() to do a shallow copy of the dictionary and use this copied dictionary to the append() method to add the dictionary to the end of the list. This method also yields the same output as above.
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_dictionaries_add.asp
Python - Add Dictionary Items
Python Lists Access List Items ... Methods List Exercises Code Challenge Python Tuples ยท Python Tuples Access Tuples Update Tuples Unpack Tuples Loop Tuples Join Tuples Tuple Methods Tuple Exercises Code Challenge Python Sets ยท Python Sets Access Set Items Add Set Items Remove Set Items Loop Sets Join Sets Frozenset Set Methods Set Exercises Code Challenge Python Dictionaries...
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-convert-a-list-to-dictionary
Convert a List to Dictionary Python - GeeksforGeeks
We are given a list we need to ... should be a dictionary like {0: 10, 1: 20, 2: 30}. We can use methods like enumerate, zip to convert a list to dictionary in python....
Published ย  July 12, 2025
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ python_dictionaries.asp
Python Dictionaries
List is a collection which is ordered and changeable. Allows duplicate members. Tuple is a collection which is ordered and unchangeable. Allows duplicate members. Set is a collection which is unordered, unchangeable*, and unindexed. No duplicate members. Dictionary is a collection which is ordered** and changeable. No duplicate members. *Set items are unchangeable, but you can remove and/or add items whenever you like. **As of Python version 3.7, dictionaries are ordered.
๐ŸŒ
Quora
quora.com โ€บ How-do-I-add-a-list-to-a-Python-dictionary
How to add a list to a Python dictionary - Quora
Answer (1 of 9): The question is not clear. If I understood you correctly, you want to convert a list into a python dictionary. You need first to differentiate between the structure of the list and the dictionary. List = An array of elements (to reach an element, you use its index) Dictionary=...
๐ŸŒ
Team Treehouse
teamtreehouse.com โ€บ community โ€บ trying-to-insert-a-list-inside-the-dictionary
Trying to insert a list inside the dictionary (Example) | Treehouse Community
June 23, 2017 - Just to recap, only imutable types can be keys (no lists, dictionaries, sets, user defined objects without a "hash" method), but anything can be a value. For example ยท my_dict = {} # Add a list: my_dict["my_list"] = [3, 1, 4, 1, 5, 9, 2] # Add a dictionary: my_dict["sub_dict"] = {"key": "value"} # Add a set: my_dict["my_set"] = set([3, 1, 4, 1, 5, 9, 2]) # Add a Tuple as a key and as a value: my_dict[(27.9878, 86.9250)] = ("Everest", "Nepal", 8848) # Prove it all worked: for key, value in my_dict.items(): print("Key: {}\nValue: {}\n\n".format(key,value))
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ collections.html
collections โ€” Container datatypes
Note that __missing__() is not called for any operations besides __getitem__(). This means that get() will, like normal dictionaries, return None as a default rather than using default_factory. defaultdict objects support the following instance variable: ... This attribute is used by the __missing__() method; it is initialized from the first argument to the constructor, if present, or to None, if absent. Changed in version 3.9: Added merge (|) and update (|=) operators, specified in PEP 584. Using list as the default_factory, it is easy to group a sequence of key-value pairs into a dictionary of lists:
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ typing.html
typing โ€” Support for type hints
1 week ago - # For creating a generic NamedTuple on Python 3.11 T = TypeVar("T") class Group(NamedTuple, Generic[T]): key: T group: list[T] # A functional syntax is also supported Employee = NamedTuple('Employee', [('name', str), ('id', int)]) Changed in version 3.6: Added support for PEP 526 variable annotation syntax. Changed in version 3.6.1: Added support for default values, methods, and docstrings. Changed in version 3.8: The _field_types and __annotations__ attributes are now regular dictionaries instead of instances of OrderedDict.
๐ŸŒ
DataCamp
datacamp.com โ€บ tutorial โ€บ python-dictionary-append
Python Dictionary Append: How to Add Key-Value Pairs | DataCamp
August 6, 2024 - In this example, we start with dictionary_w_list where the key 'fruits' maps to a list ['apple', 'banana']. By using the .append() method, we add 'cherry' to the list. This technique is particularly useful when managing collections of items within a single dictionary. Python 3.9 introduced the merge operator (|) for combining dictionaries.
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ appending-to-list-in-python-dictionary
Appending Element into a List in Python Dictionary - GeeksforGeeks
July 23, 2025 - Access the list using the dictionary key res['a'] and use append() method to add the element 4 to the list.
๐ŸŒ
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.
๐ŸŒ
Ubiq BI
ubiq.co โ€บ home โ€บ how to create dictionary from lists in python
How to Create Dictionary from Lists in Python - Ubiq BI
March 27, 2025 - In each iteration, it will pick a tuple from the result of zip function and assign one item as k and the other item as v. Each k-v pair is assigned as key-value pair to the new_dict dictionary. This solution is very easy to understand and optimized for high performance. Unlike the previous solution, you can always customize the dict comprehension, to include/exclude certain items. If you are using older Python such as Python <=2.6 then the zip function in those versions creates a list of tuples in result.
๐ŸŒ
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.