pop method returns the value corresponding to a given key, and then remove the key-value pair from the dictionary : pop « Dictionary « Python Tutorial






d = {'x': 1, 'y': 2}
d.pop('x')
print d
8.21.pop
8.21.1.pop method returns the value corresponding to a given key, and then remove the key-value pair from the dictionary
8.21.2.How to Remove Dictionary Elements and Dictionaries