我知道要从字符串中删除所有 html 标签,可以使用:
string = re.sub('<[^<]*?/?>', '', string)
但是无论如何我只能删除 anchor 标签并保留所有其他标签。例如:
<p>Some text<a href="#">link</a></p>
成为:
<p>Some text link</p>
最佳答案
关于python - 使用正则表达式仅从字符串中删除 anchor 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42076016/