In this article we learn about Python
pop functions in Python dictionaries, what the
pop function means in Python, and what this function does will be answered in the next article.
Python pop function description
The Python dictionary pop () method deletes the value of the dictionary given key key, and the return value is the deleted value. The key value must be given. Otherwise, the default value is returned.
Grammar
Pop () method syntax:
Pop (Key[,default])
Parameters
Key: The value to delete
Default: Returns the default value if there is no key.
return value
Returns the value that was deleted.
Python Pop Function Example
The following example shows how the Pop () method is used:
#!/usr/bin/python#-*-coding:utf-8-*-site= {' name ': ' Blue sky White Cloud ', ' Alexa ': 10000, ' url ': ' Www.runoob.com '}pop_obj=site.pop ( ' name ') print pop_obj # output: Blue sky and white clouds