开发者

does BeautifulSoup strips inline CSS and javascript content

hey开发者_Go百科 guys does beautifulSoup strips css and javascript content? after using

content3 = ''.join(BeautifulSoup(content).findAll(text=True))

i still have them lingering around.


What exactly do you want to strip, all script and style elements? It should be something like:

''.join(BeautifulSoup(content).findAll(text=lambda text: 
text.parent.name != "script" and 
text.parent.name != "style"))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜