update() 메서드는 지정된 항목을 사전에 삽입합니다.
지정한 항목은 사전이거나 키 값 쌍이 있는 반복 가능한(iterable) 객체일 수 있습니다.
매개변수 | 필수 | 설명 |
---|---|---|
iterable | 필수 | 사전 또는 키 값 쌍이 있는 반복 가능한(iterable) 객체로, 사전에 삽입됩니다. |
car = { "brand": "Ford", "model": "Mustang", "year": 1964 } car.update({"color": "White"}) print(car)
결과
{'brand': 'Ford', 'model': 'Mustang', 'year': 1964, 'color': 'White'}
© 2022 pinfo. All rights reserved.