dic1 = {'1':'node1','2':'node2'}
dic1.update({'3':'hello'})
print(dic1) # {'1': 'node1', '2': 'node2', '3': 'hello'}
dic1.update(dic2)既可用于修改字典中的键值对,又可用于新增字典中的键值对。
dic1 = {'1':'node1','2':'node2'}
dic1.update({'3':'hello'})
print(dic1) # {'1': 'node1', '2': 'node2', '3': 'hello'}
dic1.update(dic2)既可用于修改字典中的键值对,又可用于新增字典中的键值对。