代码
x = [1,1,2,2,3,2,3,4,5,6] y = [1,2,3,4,5] z = x + y print(z) # z = x - y # 会报错,不支持""-"操作 # print(z) sx = set(x) # 可以转集合,但会去除重复元素 sy = set(y) print(sx) print(sy) lsx = list(sx) # 可以转列表 lsy = list(sy) print(lsx) print(lsy)
2023-09-29 12:17:28
x = [1,1,2,2,3,2,3,4,5,6] y = [1,2,3,4,5] z = x + y print(z) # z = x - y # 会报错,不支持""-"操作 # print(z) sx = set(x) # 可以转集合,但会去除重复元素 sy = set(y) print(sx) print(sy) lsx = list(sx) # 可以转列表 lsy = list(sy) print(lsx) print(lsy)