擅长:python、mysql、java
<p>一个简单的双for循环:</p>
<pre><code>>>> for i in range(len(data)):
... x = set(data[i][1][0])
... for j in range(len(data)):
... if len(x & set(data[j][1][0]))>=1:
... print data[j][0], # for python 3 use print()
... print
...
topic1 topic2
topic1 topic2 topic3
topic2 topic3
topic4
</code></pre>