파이썬 사전 update() 메서드
예시
사전에 항목 삽입:
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
car.update({"color": "White"})
print(car)
정의 및 사용
메서드 는 update()
지정된 항목을 사전에 삽입합니다.
지정된 항목은 사전 또는 키 값 쌍이 있는 반복 가능한 개체일 수 있습니다.
통사론
dictionary.update(iterable)
매개변수 값
Parameter | Description |
---|---|
iterable | A dictionary or an iterable object with key value pairs, that will be inserted to the dictionary |