- union
1 PHP[ | ]
PHP
Copy
$setA = array('a', 'b', 'c', 'd');
$setB = array('c', 'd', 'e', 'f');
print_r( array_unique(array_merge($setA, $setB)) );
# Array
# (
# [0] => a
# [1] => b
# [2] => c
# [3] => d
# [6] => e
# [7] => f
# )
2 Python[ | ]
Python
Copy
A = {'a', 'b', 'c', 'd'}
B = {'c', 'd', 'e', 'f'}
print( A | B )
# {'B', 'E', 'F', 'D', 'A', 'C'}
print( set1.union(set2) )
# {'B', 'E', 'F', 'D', 'A', 'C'}
Python
3 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.