Set union operation
Set union
The union method does the set union operation.
a = set([1, 2, 3]) # from ww w.j ava2 s.com
b = set([2, 3, 4])
a.union(b)
print a
print a | b
The code above generates the following result.
The union method does the set union operation.
a = set([1, 2, 3]) # from ww w.j ava2 s.com
b = set([2, 3, 4])
a.union(b)
print a
print a | b
The code above generates the following result.