我是靠谱客的博主 秀丽菠萝,这篇文章主要介绍python dict remove数组删除(del,pop),现在分享给大家,希望可以做个参考。

比如代码

binfo = {'name':'jay','age':20,'python':'haha'}

print binfo.pop('name')#pop方法删除键,并且返回键对应的值

print binfo##输出结果:{'python': 'haha', 'age': 20}

del binfo['python']##内置方法删除元素

print binfo##输出结果:{'age': 20}

最后

以上就是秀丽菠萝最近收集整理的关于python dict remove数组删除(del,pop)的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(213)

评论列表共有 0 条评论

立即
投稿
返回
顶部