appending dictionaries to a list code example
Example 1: append dictionary python
>>> d1 = {1: 1, 2: 2}
>>> d2 = {2: 'ha!', 3: 3}
>>> d1.update(d2)
>>> d1
{1: 1, 2: 'ha!', 3: 3}
Example 2: append to dictionary python
# Append to Dictionary in Python
# Let's say we had the following dictionary:
languages = {'#1': "Python", "#2": "Javascript", "#3": "HTML"}
# There are two ways to add a key-and-value set to this dictionary
# Number 1: By .update() method
languages.update({"#4": "C#"}) # Adds a #4 key-and-value set
#--------------------------------------------
# Number 2: The define-key method
# This is the easier one
languages['#4'] = 'C#'
# ^^ Just updates a key of #4 to C#, or adds it in this case