Mega Code Archive

 
Categories / Python Tutorial / Dictionary
 

Pop method returns the value corresponding to a given key, and then remove the key-value pair from the dictionary

d = {'x': 1, 'y': 2} d.pop('x') print d