Chapters
Python114 chapters

ReferenceList methods

list.clear()

Removes everything, keeping the same list object.

Signature

items.clear()

Returns

None.

Example

Python
a = [1, 2]
b = a
a.clear()
print(a, b)

Output

[] []

See also