Python Set discard() Method

Python Set discard() Method

  • The discard() method removes the specified item from the set. 

  • This method is different from the remove() method, because the remove() method will raise an error if the specified item does not exist, and the discard() method will not.

Syntax

  • set.discard(value)

Parameter Values

  • value - The item to search for, and remove

 

Comments