The append function you're referencing only works for lists: https://docs.python.org/2/tutorial/datastructures.html

If you want to add a new key/value pair to a dictionary, use: dictionary['key'] = value

You can also opt for: dictionary.update({'key': value}), which works well for adding multiple key/value pairs at once.

Answer from Jonas on Stack Overflow
🌐
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.
Discussions

Append values to Dictionary
from collectioms import defaultdict d = defaultdict(list) [...] d[key].append(value) is probably what you want. You don't have to use defaultdict, you can also do sth like d = {} [...] if key in d: d[key].append(value) else: d[key] = [ value ] More on reddit.com
🌐 r/learnpython
9
2
June 8, 2021
Guys do not name your variable of type dictionary as myDict/mydict during your whiteboard interviews!
That's one way to get them to remember you. More on reddit.com
🌐 r/Python
112
1673
July 13, 2020
Using Openpyxl how can I write a dictionary into two columns of keys and values?
Did you check openpyxl documentation ? There is simple example main_sheet.cell(column=1 , row=next_row, value=key) main_sheet.cell(column=2 , row=next_row, value=value) next_row += 1 More on reddit.com
🌐 r/learnpython
1
2
August 11, 2016
Appending object to list overwrites previous objects when using dictionary
class Student(): studentDictionary = { "name": "", "gpa": "" } This doesn't work the way you think, coming from Java. Defining a variable at class scope doesn't create a field on the object, it creates an attribute of the class. This is Python, the language where (unlike Java) everything really is an object, including the classes you write (an object's class itself being an object of the type type.) You can think of this as a "static field", in the Java parlance, since the class's single value for the attribute studentDictionary is shared and accessible (and mutable) by all instances of the Student class. But there's no particular reason to do it this way. If an object of the Student class has a name and gpa, then just set those attributes on the object when you initialize it: class Student: def __init__(self, name, gpa): self.name = name self.gpa = gpa Simpler (and explicit) is better than more complicated. More on reddit.com
🌐 r/learnpython
11
2
March 18, 2021
🌐
Codecademy
codecademy.com › article › python-dictionary-append-how-to-add-items-to-dictionary
Python Dictionary Append: How to Add Items to Dictionary | Codecademy
This method is especially useful in scenarios like reading data, processing lists, or taking user input. Syntax of using a loop for adding items to a dictionary is: for key, value in some_iterable: dictionary[key] = value ... Ideal for bulk population from lists, files, APIs, etc. ... Now that you’ve seen different ways to add items to dictionaries in Python, let’s summarize the techniques and help you choose the best one for your use case.
🌐
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 - 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.
🌐
GeeksforGeeks
geeksforgeeks.org › python › append-a-value-to-a-dictionary-python
Append a Value to a Dictionary Python - GeeksforGeeks
July 23, 2025 - For example, consider the dictionary d = {'a': 1, 'b': 2, 'c': 3}. If we want to append new data, such as adding the key-value pairs 'd': 4 and 'e': 5, the dictionary will be updated accordingly. update() method is one of the most efficient ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-add-to-dictionary
How to Add and Update Python Dictionaries Easily | DigitalOcean
October 16, 2025 - The following example demonstrates how to create two dictionaries, use the update operator to append the second dictionary to the first dictionary, and then print the updated dictionary: site = {'Website':'DigitalOcean', 'Tutorial':'How To Add to a Python Dictionary', 'Author':'Sammy'} guests = {'Guest1':'Dino Sammy', 'Guest2':'Xray Sammy'}
🌐
Python documentation
docs.python.org › 3 › tutorial › datastructures.html
5. Data Structures — Python 3.14.6 documentation
Dictionaries are sometimes found in other languages as “associative memories” or “associative arrays”. Unlike sequences, which are indexed by a range of numbers, dictionaries are indexed by keys, which can be any immutable type; strings and numbers can always be keys. Tuples can be used as keys if they contain only strings, numbers, or tuples; if a tuple contains any mutable object either directly or indirectly, it cannot be used as a key. You can’t use lists as keys, since lists can be modified in place using index assignments, slice assignments, or methods like append() and extend().
Find elsewhere
🌐
Python Guides
pythonguides.com › python-dictionary-append
How to Append a Dictionary in Python
October 28, 2025 - Appending a dictionary in Python simply means adding new key-value pairs to an existing dictionary or merging two or more dictionaries. Unlike lists, dictionaries don’t have an append() method.
🌐
W3Schools
w3schools.com › python › python_dictionaries_add.asp
Python - Add Dictionary Items
Python Dictionaries Access Items Change Items Add Items Remove Items Loop Dictionaries Copy Dictionaries Nested Dictionaries Dictionary Methods Dictionary Exercises Code Challenge Python If...Else
🌐
FavTutor
favtutor.com › blogs › dictionary-append-python
Dictionary Append in Python | 3 Methods (with code)
September 11, 2023 - Learn various methods for how to append values in a dictionary in Python including update method or dictionary comprehension.
🌐
Guru99
guru99.com › home › python › python dictionary append: how to add key/value pair
Python Dictionary Append: How to Add Key/Value Pair
August 13, 2025 - We can make use of the built-in function append() to add elements to the keys in the dictionary. To add element using append() to the dictionary, we have first to find the key to which we need to append to. ... The keys in the dictionary are Name, Address and Age.
🌐
GeeksforGeeks
geeksforgeeks.org › python › appending-a-dictionary-to-a-list-in-python
Appending a Dictionary to a List in Python - GeeksforGeeks
July 23, 2025 - For example, when building a collection ... 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....
🌐
freeCodeCamp
freecodecamp.org › news › add-to-dict-in-python
Adding to Dict in Python – How to Append to a Dictionary
February 28, 2023 - Example using the update() method to add multiple entries to a dictionary: myDict = {'a': 1, 'b': 2} new_data = {'c': 3, 'd': 4} myDict.update(new_data) print(myDict) ... Another fun thing about this method is that, we can use the update() method ...
🌐
Altcademy
altcademy.com › blog › how-to-append-to-a-dictionary-in-python
How to append to a dictionary in Python - Altcademy.com
June 13, 2023 - You simply assign a value to a new key, and Python will automatically add the key-value pair to the dictionary. Here's an example: # Appending a new key-value pair to the dictionary person["country"] = "USA" # Printing the updated dictionary ...
🌐
PyTutorial
pytutorial.com › python-dictionary-append-a-simple-guide
PyTutorial | Python Dictionary Append: A Simple Guide
1 month ago - Many beginners ask if Python dictionaries have an append method. The answer is no. Lists have append, but dictionaries don't. Dictionaries store data as key-value pairs. You add new items by assigning a value to a new key.
🌐
TechBeamers
techbeamers.com › python-append-to-dictionary
Python Append to Dictionary - TechBeamers
November 30, 2025 - Method 6. Using Collections DefaultDict() ... Appending to a dictionary means adding a new key-value pair to it. However, Python dictionaries don’t have an “append” method like lists do.
🌐
TutorialsPoint
tutorialspoint.com › article › appending-to-list-in-python-dictionary
Appending to list in Python Dictionary
March 27, 2026 - Use append() to add single elements, += to extend lists with multiple elements, and update() to replace entire list values. All methods modify the original dictionary in place, making them efficient for list manipulation within dictionaries.
🌐
Reddit
reddit.com › r/learnpython › append values to dictionary
r/learnpython on Reddit: Append values to Dictionary
June 8, 2021 -

I am currently using a while loop to loop and get certain values. I then want to append these values to a dictionary. Every loop through I want to append to two keys

General structure of the code: https://pastebin.com/p4hJcKR5

I have tried using:

dict[key] = value

dict.append(value)

And neither have worked, dict.append gives an error and dict[key] just sets the dictionary to the most recent iteration instead of iterating for all values. Any help would be appreciated.

🌐
Career Karma
careerkarma.com › blog › python › python add to dictionary: a guide
Python Add to Dictionary: A Guide | Career Karma
December 1, 2023 - There is no add(), append(), or insert() method you can use to add an item to a dictionary in Python.