组合数据类型
一、 集合类型概述
- 操作符
>>> s = {1010,'python',78.9}
>>> t = {1010,'set',12.3,1010,1010}
>>> s - t # 差集
{78.9, 'python'}
>>> s & t # 交集
{1010}
>>> s ^ t # 补集
{'set', 12.3, 78.9, 'python'}
>>> s | t #并集
{1010, 'python', 'set', 12.3, 78.9}
- 常用操作函数或方法
- add 添加
- remove 删除
- clear 清空
- len 返回长度
二、实战总结
总结
将日常生活中遇到的问题进行总结,后期会不断更新