Python中过滤HTML标签的函数

作者: gavin 分类: Python 发布时间: 2020-09-12 17:03
#用正则简单过滤html的<>标签
import re
str = "<img /><a>srcd</a>hello</br><br/>"
str = re.sub(r'</?\w+[^>]*>','',str)
print (str)
import re

test='<p>just for test</p><br/><font>just for test</font><b>test</b>'
pat = re.compile('(?<=\>).*?(?=\<)')
result=''.join(pat.findall(test))

Warning: Undefined variable $aria_req in /www/wwwroot/l.lvovl.cn/wp-content/themes/JieStyle-Two-master/comments.php on line 26

Warning: Undefined variable $aria_req in /www/wwwroot/l.lvovl.cn/wp-content/themes/JieStyle-Two-master/comments.php on line 27

Warning: Undefined variable $aria_req in /www/wwwroot/l.lvovl.cn/wp-content/themes/JieStyle-Two-master/comments.php on line 28
标签云