擅长:python、mysql、java
<blockquote>
<p>Please, note, that usually it is not normal to do it by regular expressions. See <a href="https://stackoverflow.com/a/12824035/284947">Jeremiah answer</a>.</p>
</blockquote>
<p>试试这个:</p>
<pre><code>import re
text = re.sub('<[^<]+>', "", open("/path/to/file").read())
with open("/path/to/file", "w") as f:
f.write(text)
</code></pre>