Function Details: clear_(dict)

Description


Removes all items from the dictionary.


Extended Description


The clear() method removes all key-value pairs from the dictionary, leaving it empty. This operation is in-place, meaning it modifies the original dictionary rather than creating a new one. After calling clear(), the dictionary will have a length of 0.


Read More about clear_(dict) from Python Documentation

Function Signature


dict.clear() -> None

Module: builtins

Class: dict

Parameters



Return


This method doesn't return a value (None).


Return Type


None

Output

Explanation

This example shows how clear() removes all items from a dictionary.