您的位置:首页 > 编程语言 > Python开发

set().union(set1, set2)(关键词:Python/集合/set/union()/并集)

2018-03-07 10:19 141 查看
>>> set.union({1, 2}, {2, 4, 5})
set([1, 2, 4, 5])
>>> set().union({1, 2}, {2, 4, 5})
set([1, 2, 4, 5])


不管是
set.union(set1, set2)
还是
set().union(set1, set2)
,返回的都是两个集合
set1
set2
的并集。

参考文献:

1. 暂缺。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息