开发者

does BeautifulSoup strips inline CSS and javascript content

开发者 https://www.devze.com 2023-01-02 14:58 出处:网络
hey开发者_Go百科 guys does beautifulSoup strips css and javascript content? after using content3 = \'\'.join(BeautifulSoup(content).findAll(text=True))

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

精彩评论

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