appending value to dictionary python code example
Example 1: add item to python dictionary
data = dict()
data['key'] = value
Example 2: how to append to a dictionary in python
d = {'a': 1, 'b': 2}
print(d)
d['a'] = 100
d['c'] = 3
d['d'] = 4
print(d)
Example 3: append to dictionary python
languages = {'#1': "Python", "#2": "Javascript", "#3": "HTML"}
languages.update({"#4": "C#"})
languages['#4'] = 'C#'
Example 4: python dict append value
default_data = {'item1': 1,
'item2': 2,
}
default_data.update({'item3': 3})
default_data['item3'] = 3