Python 字典 update() 方法
实例
向字典插入项目:
car = {
  "brand": "Porsche",
  "model": "911",
  "year": 1963
}
car.update({"color": "White"})
print(car)
定义和用法
update() 方法向字典插入指定的项目。
这个指定项目可以是字典或可迭代对象。
语法
dictionary.update(iterable)
向字典插入项目:
car = {
  "brand": "Porsche",
  "model": "911",
  "year": 1963
}
car.update({"color": "White"})
print(car)
update() 方法向字典插入指定的项目。
这个指定项目可以是字典或可迭代对象。
dictionary.update(iterable)