python dictionary append list code example
Example 1: python dictionary of lists append
myDict = {}
myDict["key1"] = [1, 2]
lst = ['Geeks', 'For', 'Geeks']
myDict["key1"].append(lst)
print(myDict)
Example 2: Python dictionary append
d1 = {
"1" : 1,
"2" : 2,
"3" : 3
}
d1["4"] = 4
print(d1)
Example 3: Python dictionary append
testing1={'one':1,'two':2}
''' update() is the method of dict() merges another dict into existing ones '''
''' it replaces the keys of exisiting ones with the the new ones '''
testing1.update({'two':3,'noice':69})
print(testing1) """ {'one':1,'two':3,'noice':69} """