擅长:python、mysql、java
<p>如果您的输入如下所示:</p>
<pre><code>in_1 = [(1, 1), (2, 2), (3, 3)]
in_2 = [(4, 4), (5, 5), (1, 1)]
in_3 = [(6, 6), (7, 7), (1, 1)]
ins = [in_1, in_2, in_3]
</code></pre>
<p>然后我想你可以用<code>itertools.combinations</code>来找到两两相交的地方,然后从中取一个<code>set</code>来删除重复的地方。你知道吗</p>
<pre><code>from itertools import combinations
intersected = []
for first, second in combinations(ins, 2):
elems = set(first).intersection(set(second))
intersected.extend(elems)
dedup_intersected = set(intersected)
print(dedup_intersected)
# {(1, 1)}
</code></pre>