Python Set update() 메서드
예시
세트의 항목을 세트에 삽입 y
하십시오
x
.
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.update(y)
print(x)
정의 및 사용
이 update()
메서드는 다른 집합(또는 다른 반복 가능한 항목)의 항목을 추가하여 현재 집합을 업데이트합니다.
항목이 두 세트에 모두 있는 경우 업데이트된 세트에는 이 항목이 하나만 나타납니다.
통사론
set.update(set)
매개변수 값
Parameter | Description |
---|---|
set | Required. The iterable insert into the current set |