how to append value in dictionary in python code example
Example 1: 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 2: python append to dictionary
dict = {1 : 'one', 2 : 'two'}
print(dict)
dict[3] = 'three'
print(dict)
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