Definition
The clear() method removes all the elements from a list.
Syntax
list.clear()
Parameters
No Parameters.
Examples:
cars = ['Nissan', 'Ford', 'Volkswagen']
cars.clear()
print(cars)
The clear() method removes all the elements from a list.
list.clear()
No Parameters.
cars = ['Nissan', 'Ford', 'Volkswagen']
cars.clear()
print(cars)