To completely delete a list in Python, you can use the del
statement. This removes the list from memory entirely.
Syntax:
Example:
Notes:
- After using
del
, the list will no longer exist, and you cannot use it further. - Ensure you don’t try to access the list after deletion, as it will lead to a
NameError
.