How python uses popitem () to delete dictionary key-value pairs
Editor to share with you how python uses popitem () to delete the dictionary key value pair, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Popitem () deletes dictionary key-value pairs
Popitem () deletes the dictionary key-value pair, deletes it according to the last set of key-value pairs, and returns the meta-ancestor composed of the deleted key-value pair.
Dict4 = {'name':' Tom', 'age': 18} res = dict4.popitem () print (dict4, res)
{'name':' Tom'} ('age', 18)
The above is all the content of the article "how python uses popitem () to delete dictionary key-value pairs". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!