擅长:python、mysql、java
<p>使用regex很复杂,这是我建议的一种愚蠢的方式:</p>
<pre><code>def remove_table(s):
left_index = s.find('<table>')
if -1 == left_index:
return s
right_index = s.find('</table>', left_index)
return s[:left_index] + remove_table(s[right_index + 8:])
</code></pre>
<p>结果中可能有一些空行。你知道吗</p>