PythonListclear

Removes all items from the list.

Syntax

list.clear()

Example

Enter values below to update the example in real time.

nums
clear
print
nums = [1, 2, 3]
nums.clear()
print(nums)  # []