Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to Add Elements to a dictionary using the update() method

myDictionary = {
    "first": "A",
    "second": "B",
    "third": "C",
}
myDictionary.update({"fourth": "D"})
print(myDictionary)
# Output:
# {'first': 'A', 'second': 'B', 'third': 'C', 'fourth': 'D'}
Comment

PREVIOUS NEXT
Code Example
Python :: difference_update() Function of sets in python 
Python :: How to Loop Through Tuples using while loop in python 
Python :: flask env variable 
Python :: Adding new nested object using Shallow copy 
Python :: python Least prime factor of numbers till n 
Python :: how to connect presto from python 
Python :: plot multiple ROC in python 
Python :: isclass function in python xml 
Python :: Mirror Inverse Program in python 
Python :: is c++ easier than python 
Python :: paginate @registrations 
Python :: python c api 
Python :: Get Results From Table Django 
Python :: Problem With This? 
Python :: enumerate count 
Python :: how to unpack in python 
Python :: commend in .env 
Python :: python two list into dictinaray 
Python :: django orm filter equal insensitive 
Python :: python developer 
Python :: how to minimisze python console 
Python :: how to use ttk themes 
Python :: tqdm continues afer break 
Python :: deepface facebook python 
Python :: validate delete inline formset django 
Python :: pymol load coords 
Python :: python itérer dictionnaire 
Python :: py random sample 
Python :: Python ValueError in strptime() 
Python :: model summary change size of columns 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =