python dict remove数组删除(del,pop)
2013-03-24 00:00
1076 查看
比如代码
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}
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 数组的del ,remove,pop区别
- python 3.x中列表中元素删除del、remove、pop的用法及区别
- python 数组的del ,remove,pop区别
- Python基础学习--删除元素(remove,del,pop)
- Python笔记——python 3.x中列表中元素删除del、remove、pop的用法及区别
- 对python中数组的del,remove,pop区别详解
- Python3列表元素的修改,添加( append(),inset() )和删除( del,pop(),remove() )操作
- python dict remove,删除
- Python之List中remove,pop,del区别分析
- python:remove,pop和del方法的区别
- Python可迭代对象中的添加和删除(add,append,pop,remove,insert)
- Python对于列表的del, remove, pop操作的区别
- python remove和del的区别,python 循环删除元素
- 列表:list[1],切片list[1:3],追加insert,修改,删除remove,del,pop,查找index,统计count,清空list.clear() 翻转list.reverse(),排序list.sort(),扩展list.extend,
- Python append , pop, del 和 remove 基础知识篇
- Python可迭代对象中的添加和删除(add,append,pop,remove,insert)
- 1007 Python之List中remove,pop,del区别分析
- python-pop,del,remove
- [Python基础]Python中remove,del和pop的区别