Python Dictionary pop() Method

Python Dictionary pop() Method

  • Python dictionary pop() is an inbuilt function that removes the specified element from the dictionary. 

  • The dict pop() method removes and returns an element from a dictionary provided the given key. 

  • The value of the removed element is the removed item of the pop() method.

Syntax

  • dictionary.pop(keyname, defaultvalue)

Parameter Values

  • key - key which is to be searched for removal 

  • default - value which is to be returned when the key is not in the dictionary

 

 

Comments