博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python内置类 set
阅读量:3922 次
发布时间:2019-05-23

本文共 1432 字,大约阅读时间需要 4 分钟。

class set([iterable])

class frozenset([iterable])
Return a new set or frozenset object whose elements are taken from iterable. The elements of a set must be hashable. To represent sets of sets, the inner sets must be frozenset objects. If iterable is not specified, a new empty set is returned.

Instances of set and frozenset provide the following operations:

len(s)

Return the number of elements in set s (cardinality of s).

x in s

Test x for membership in s.

x not in s

Test x for non-membership in s.

isdisjoint(other)

Return True if the set has no elements in common with other. Sets are disjoint if and only if their intersection is the empty set.

issubset(other)

set <= other
Test whether every element in the set is in other.

set < other

Test whether the set is a proper subset of other, that is, set <= other and set != other.

issuperset(other)

set >= other
Test whether every element in other is in the set.

set > other

Test whether the set is a proper superset of other, that is, set >= other and set != other.

union(*others)

set | other | …
Return a new set with elements from the set and all others.

intersection(*others)

set & other & …
Return a new set with elements common to the set and all others.

difference(*others)

set - other - …
Return a new set with elements in the set that are not in the others.

symmetric_difference(other)

set ^ other
Return a new set with elements in either the set or other but not both.

转载地址:http://elhrn.baihongyu.com/

你可能感兴趣的文章
2021,未来可期
查看>>
阿星Plus:基于abp vNext开源一个博客网站
查看>>
写给自己,2020的年终总结
查看>>
Flash 生命终止,HTML5能否完美替代?
查看>>
ML.NET生成器带来了许多错误修复和增强功能以及新功能
查看>>
微信适配国产操作系统:原生支持 Linux
查看>>
我的2020年终总结:新的角色,新的开始
查看>>
C# 9 新特性 —— 增强的模式匹配
查看>>
ASP.NET Core Controller与IOC的羁绊
查看>>
如何实现 ASP.NET Core WebApi 的版本化
查看>>
探索 .Net Core 的 SourceLink
查看>>
AgileConfig-如何使用AgileConfig.Client读取配置
查看>>
【gRPC】 在.Net core中使用gRPC
查看>>
整合.NET WebAPI和 Vuejs——在.NET单体应用中使用 Vuejs 和 ElementUI
查看>>
“既然计划没有变化快,那制订计划还有个卵用啊!”
查看>>
C#实现网页加载后将页面截取成长图片
查看>>
C# 在自定义的控制台输出重定向类中整合调用方信息
查看>>
【gRPC】ProtoBuf 语言快速学习指南
查看>>
C# 9 新特性 —— 补充篇
查看>>
Asp.Net Core使用Skywalking实现分布式链路追踪
查看>>