# coding=utf-8 s1 = set([1, 2, 3, 4, 5]) s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9]) if not s1.isdisjoint(s2): if s1.issubset(s2): for num in s1: print(num) else: for number in s2: print(number) else: print('无重合')
我运行了一下,没啥大问题,最后的输出报错了,改成none就没问题了,能正常运行
,,,