python dictionary append to value code example
Example 1: python append to dictionary
dict = {1 : 'one', 2 : 'two'}
# Print out the dict
print(dict)
# Add something to it
dict[3] = 'three'
# Print it out to see it has changed
print(dict)
Example 2: dictionary append value python
d = {1:2}
d.update({2: 4})
print(d) # {1: 2, 2: 4}