Python‎ > ‎set‎ > ‎

set.discard()

http://www.adilwaseem.com/

Introduction
Remove an element from a set if it is a member.

Syntax
set.discard(x)

Parameters
x=an element in set

 Example
set1={3,45,344,66}
set2={1,44,66}
set3=set1.difference(set2)
set1.difference_update()
set1.discard(344)
print("Please discard the element 344 of set1 and print rest of the elements", set1)

Output
>>> 
Please discard the element 344 of set1 and print rest of the elements {66, 3, 45}
>>> 

Comments