pipu

关注

python里面的列表的并交差集合运算

pipu

关注

阅读 12

2022-05-25


A = range(1,10)
B = range(5,15)
C =range(8,20)

# A并B并c

result2 = list(set(A).intersection(set(B)).intersection(set(C)))
print(result2)


# AUBUC 并集
result3 = list(set(A).union(set(B).union(C)))
print(result3)

# 差集
# 元素在 A not B
result4 = list(set(A).difference(set(B)))
print(result4)


相关推荐

大师的学徒

Android里面的列表

大师的学徒 44 0 0

RJ_Hwang

Oracle-SET运算符/查询的并交差

RJ_Hwang 154 0 0

sunflower821

python里面的==,is的区别

sunflower821 165 0 0

潇湘落木life

Python编程:pkgutil获取包里面的所有模块列表

潇湘落木life 78 0 0

Star英

如何对列表里面的字典排序

Star英 209 0 0

花姐的职场人生

python里面的pathlib包

花姐的职场人生 12 0 0

一条咸鱼的干货

python如何透过某个字段取得集合里面的值

一条咸鱼的干货 28 0 0

ZMXQQ233

python里面request里面的data太长怎办

ZMXQQ233 36 0 0

Alex富贵

【swust】1037: 集合的并运算的实现

Alex富贵 46 0 0

幸福的无所谓

python 获取text 里面的json

幸福的无所谓 74 0 0

精彩评论(0)

0 0 举报