Python之集合set,,集合set无序1.无
Python之集合set,,集合set无序1.无
集合set无序
1.无序index
2.不重复 (和js Set相似)
3.空集合 set()
4.可以使用len(set()) 查看长度
差集
{ 1, 2, 3, 4, 5, 6 } - { 3, 4 } => { 1, 2, 5, 6 }
交集
{ 1, 2, 3, 4, 5, 6 } & { 3, 4 } => { 3, 4 }
合集|并集
{ 1, 2, 3, 4, 5, 6 } | { 3, 4, 7 } => { 1, 2, 3, 4, 5, 6, 7 }
字典dict {}
key:value
{}[key]
key需要时不可变类型 int、str 、tuple
Python之集合set
相关内容
- Python Tuple(元组) tuple()方法,,描述Python 元
- 终结 Python 原生字典?这个库要逆天改命了,
- python中判断对象类型的函数——isinstance,,isinstance
- python实例化类,数据混乱、串内容问题(可变类型属性
- python tips:dict的key顺序,,python3.6+
- selenium+python自动化测试--读取excel数据,,1、excel中数据
- 第2章 Python数据类型 练习题&作业,,1.创建一个空
- 在sublime编辑器中安装python,,了解如何在subli
- python 分词,,importjieb
- python并发编程:异步IO(Asynchronous I/O),,异步IO(Async
评论关闭