0
点赞
收藏
分享

微信扫一扫

python正则表达式去除html标签的属性?

jjt二向箔 2022-10-03 阅读 79


import re
test='<p class="pictext" align="center">陈细妹</p>'
test=re.sub(r'(<[^>\s]+)\s[^>]+?(>)', r'\1\2', test)
print(test)

输出

<p>陈细妹</p>


举报

相关推荐

0 条评论