Name

del

Examples
a = [1,2,3]
print(a) # Prints: [1,2,3]
del a[0]   # Delete the list member at index 0. 
print(a) # Prints: [2, 3]
del a      # Delete the variable 'a'

b = {'a': 1, 'b': 2, 'c': 3}
print('a' in b) # Prints 'True'

del b['a']
print('a' in b) # Prints 'False'
Description Remove an item from a list given its index, or a key/value pair from a dictionary. The del keyword can also delete an entire variable.
Syntax
del a
Parameters
alist or dictionary to delete from, or variable to delete
iindex of list member or key of key/value pair to delete
Updated on Tue Jul 11 06:52:23 2017.
Creative Commons License