Python Dictionary clear() Method

Example

Remove all elements from the car list:

car = {
  "brand": "Porsche",
  "model": "911",
  "year": 1963
}
car.clear()
print(car)

Run Instance

Definition and Usage

The clear() method removes all elements from the list.

Syntax

dictionary.clear()

Parameter value

No parameters.