PythonDictionaryclear
setdefault

clearDictionary

copy

Removes all items from the list.

Syntax

dict.clear()

Example

Enter values below to update the example in real time.

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