symmetric_difference_update(…)
Report whether this set contains another set.
- In [169]: s1
- Out[169]: {0, 1, 2}
- In [170]: s2
- Out[170]: {0, 1, 2, 3, 4}
- In [172]: s2.issuperset(s1)
- Out[172]: True
s2大年夜于s1
issubset()一个集合包含于另一个集合
issubset(…)
Report whether another set contains this set.
- In [169]: s1
- Out[169]: {0, 1, 2}
- In [170]: s2
- Out[170]: {0, 1, 2, 3, 4}
- In [171]: s1.issubset(s2)
- Out[171]: True
s1被s2包含
集合的数据类型转换
重要转换为序列类型。
最后
集合是一个异常有意思的数据构造,他或许不被经常应用,然则在比较严格的履行情况下,集合是一个异常好的选择。
【编辑推荐】
- 基于Python和JavaScript编写物联网温度计法度榜样
- Python中的函数与办法 以及Bound Method和Unbound Method
- 用Python多线程实现临盆者花费者模式
- Python收集爬虫实现道理与实现技巧
- 用Python写一个NoSQL数据库
推荐阅读
作为办事的灾害恢复,是经由过程云来降低营业办事成本的好办法。在内部,灾害恢赋臣芏着在另一个地位创建临盆>>>详细阅读
本文标题:Python集合set和frozenset的内建方法详解
地址:http://www.17bianji.com/lsqh/35321.html
1/2 1