Python List clear()

The clear() method removes all items from the list. Here's a quick example:

models = ['Claude', 'ChatGPT', 'Gemini', 'ChatGPT']

models.clear()
print(models)

Output

[]

clear() Syntax

The syntax of clear() is:

my_list.clear()

Arguments

clear() doesn't take any arguments.

Return Value

clear() doesn't return any value (returns None).


Example: Clear a List with Nested Items

models = [("Claude", 2023), ("DeepSeek", 2025)]

models.clear()
print(models)

Output

[]

Example: Emptying a List Using del

We can also empty a list using the del