小白教程
所有教程
关于
Search
172.70.131.51
172.70.131.51
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Ref set isdisjoint”的源代码
本页内容
上一节:
Ref_set_intersection_update
下一节:
Ref_set_issubset
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:isdisjoint()}}[[Category:python3 set|9]] = Python Set isdisjoint() 方法 = [[python3 set#setmethod|Python 集合]] == 描述 == isdisjoint() 方法用于判断两个集合是否包含相同的元素,如果没有返回 True,否则返回 False。。 == 语法 == isdisjoint() 方法语法: <sample title="" desc="" lang="python" hererun="1"> set.isdisjoint(set) </sample> == 参数 == * set -- 必需,要比较的集合 == 返回值 == 返回布尔值,如果不包含返回 True,否则返回 False。 判断集合 y 中是否有包含 集合 x 的元素: == 实例 1 == <sample title="" desc="" lang="python" hererun="1"> x = {"apple", "banana", "cherry"} y = {"google", "xiaobai", "facebook"} z = x.isdisjoint(y) print(z) </sample> 输出结果为: <sample title="" desc="" lang="python" hererun="1"> True </sample> 如果包含返回 False: == 实例 1 == <sample title="" desc="" lang="python" hererun="1"> x = {"apple", "banana", "cherry"} y = {"google", "xiaobai", "apple"} z = x.isdisjoint(y) print(z) </sample> 输出结果为: <sample title="" desc="" lang="python" hererun="1"> False </sample> [[python3 set#setmethod|Python 集合]]
返回至“
Ref set isdisjoint
”。
上一节:
Ref_set_intersection_update
下一节:
Ref_set_issubset