python 并集union 交集intersection 差集difference 对称差集symmetric_difference
python 并集union, 交集intersection, 差集difference, 对称差集symmetric_difference a,b,c = [1,2,3],[2,3,4],[3,4,5] print('------>union') print('a,b取并集:',set(a).union(b)) print('a,b取并集:',set(a)|set(b)) print('a,b,c取并集:',set(a).union(b,c)) print('a,b,c取并集:',set(a)|set(b)|set(c)) print('------>intersection')
用户评论