The purpose of the del statement is to
delete things. The general form is:
delL0,L1, ...
where each
is a
destination (described
above under the assignment statement). You can delete:Li
A variable. For example, the statement
del i, j
causes variables i and
j to become
unbound, that is,
undefined.
An element or slice of a list. For example,
del L[5], M[-2:]
would delete the sixth element of list L and the last two elements of list
M.
One entry in a dictionary. For example, if
D is a dictionary,
del D["color"]
would delete from D the
entry for key "color".