擅长:python、mysql、java
<p>您可以将<code>cursewords</code>强制转换为<code>set</code>,以提高查找效率,并使用列表理解,在较小的情况下比更通用的循环更有效:</p>
<pre><code>curseword = {'fuxx', 'die', 'damn'}
text = [ ['i','am','a','boy'] , [....] , [....] ]
new_text = map(int, [all(b not in curseword for b in i) for i in text])
</code></pre>