append to a key in dictionary python code example
Example 1: how to add an element in dictionary
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
thisdict["color"] = "red"
print(thisdict)
Example 2: python dict append value
default_data = {'item1': 1,
'item2': 2,
}
default_data.update({'item3': 3})
# or
default_data['item3'] = 3