【Python】配列に重複している要素があるか確認する

one = [1, 2]
two = [2, 3]
three = [4, 5]

print(set(one).isdisjoint(two)) # False
print(set(two).isdisjoint(three)) # True

参考:https://docs.python.org/ja/3/library/stdtypes.html

目次