返回并集,等价于 | 运算符。
|
others
新集合
a, b = {1, 2}, {2, 3} print(a.union(b), a | b) print(a.union([9], (8,)))
{1, 2, 3} {1, 2, 3} {8, 1, 2, 9}