Collection Methods

collections.deque.remove()

Remove the first item equal to the value; raise ValueError if absent.

Formal Syntax & Structure

python syntaxpython
deque_instance.remove(x, /)

Parameters & Attributes

NameTypeDescription
xobjectValue to append, remove, search for or insert.

Return Value

None

No return value; the operation changes the receiver in place.

Working Example

Example Snippetpython
import collectionsd=collections.deque([1,2,1])d.remove(1)print(list(d))
Python Reference