Learn Before
Concept
clear()
The clear() method removes all items from a dictionary structure. Usage:
student = { "name": "John Smith", "year": 3, "major": "Computer Science" } student.clear() print(student)
The clear() method removes all items in the student dictionary. The final print statement outputs {}.
0
1
Updated 2021-05-17
Tags
Python Programming Language
Data Science