Python del Keyword
Definition and Usage
del is used to delete objects. In Python, everything is an object, so the del keyword can be used to delete variables, lists, or list slices, etc.
More Examples
Example
Delete variable:
x = "hello" del x print(x)
Example
Delete the first item in the list:
x = ["apple", "banana", "cherry"] del x[0] print(x)