One - One Code All

Blog Content

Python字典 pop() 方法

Python   2008-05-16 17:05:16

描述

Python 字典 pop() 方法删除字典给定键 key 所对应的值,返回值为被删除的值。key值必须给出。 否则,返回default值。
语法

pop()方法语法:

pop(key[,default])

参数

    key: 要删除的键值
    default: 如果没有 key,返回 default 值

返回值

返回被删除的值。


上一篇:linux统计当前目录下文件夹大小du-sh
下一篇:Python删除字典中元素

The minute you think of giving up, think of the reason why you held on so long.