擅长:python、mysql、java
<pre class="lang-py prettyprint-override"><code>import re
new_string = string1
for word in forbidden_words:
new_string = re.sub(word, '', new_string)
</code></pre>
<p>你的<code>new_string</code>就是你想要的。不过,它有点长,删除一些单词后会留下2个空格,如<code>This is a list that I'd like to be readable</code></p>