Collection Methods
collections.deque.clear()
Remove all items in place without changing maxlen.
Formal Syntax & Structure
python syntaxpython
deque_instance.clear()Return Value
None
No return value; the operation changes the receiver in place.
Working Example
Example Snippetpython
import collectionsd=collections.deque([1,2],maxlen=3)d.clear()print((list(d),d.maxlen))