1.交集
x & y
# 交集
2.并集
x | y
# 并集
3.差集
x -
y
# 差集
4.对称差集
a_list = [1, 2, 3, 4, 5]
b_list = [1, 4, 5]
ret_list = list(set(a_list)^set(b_list))
print(ret_list)
参考资料
https://blog.csdn.net/weixin_42575020/article/details/100038435
x & y
# 交集
2.并集
x | y
# 并集
3.差集
x -
y
# 差集
4.对称差集
a_list = [1, 2, 3, 4, 5]
b_list = [1, 4, 5]
ret_list = list(set(a_list)^set(b_list))
print(ret_list)
参考资料
https://blog.csdn.net/weixin_42575020/article/details/100038435