可以使用 & 或者 intersection 方法:
In [1]: a = {1, 3, 4}
In [2]: b = {1, 2, 3, 5}
In [3]: a & b
Out[3]: {1, 3}
In [4]: a.intersection(b)
Out[4]: {1, 3}
可以使用 & 或者 intersection 方法:
In [1]: a = {1, 3, 4}
In [2]: b = {1, 2, 3, 5}
In [3]: a & b
Out[3]: {1, 3}
In [4]: a.intersection(b)
Out[4]: {1, 3}