python集合
来源:互联网 发布:遭受网络攻击 损失 编辑:程序博客网 时间:2024/06/06 21:14
1.集合的定义:集合是无序的,不重复的数据组合,集合里不能定义列表
2.集合:{ }
3.集合的添加:
eg:haha.add("ss")
在集合后添加一项
haha.update(["sd","sa"])
在集合中添加多项,跟的参数是可迭代类型
4.集合的删除:
eg:haha.remove("ss")
删除集合中的元素
haha.pop( )
随机删除集合中的某个元素,并返回删除的元素
5.集合的其他操作:
eg:len(haha) 显示集合的长度
a in haha 检测某元素是否是集合的
haha.clear( ) 清空所有元素
阅读全文
0 0
- python 集合
- python集合
- python 集合
- [python]集合
- Python 集合
- Python 集合
- python集合
- Python集合
- Python--集合
- Python:集合
- Python 集合
- Python集合
- python集合
- python 集合
- python 集合
- Python 集合
- Python集合
- python-集合
- MySQL-范式与反范式
- 1951: [Sdoi2010]古代猪文
- 在纪中的第六天,2017-7-12 总结:
- python文件操作练习
- 关于C语音二维数组的进一步理解
- python集合
- 【android】禁止EditText自动获取焦点
- 循环删除list中元素的方法
- HBase 的那一点知识
- JavaScript事件
- 51nod1240 莫比乌斯函数(普通筛法)
- hdu 1896 优先队列
- 判断文件或者文件夹是否存在
- HDU 1829 A Bug's Life(基础种类并查集)