Python Set remove() 메서드
예시
세트에서 "바나나" 제거:
fruits = {"apple", "banana", "cherry"}
fruits.remove("banana")
print(fruits)
정의 및 사용
이 remove()
메서드는 집합에서 지정된 요소를 제거합니다.
이 메서드는 메서드와 다릅니다 . 지정된 항목이 없으면 메서드 에서 오류가 발생discard()
하고
remove()
메서드 가 발생하지 않기 때문 입니다.discard()
통사론
set.remove(item)
매개변수 값
Parameter | Description |
---|---|
item | Required. The item to search for, and remove |