Makes BeautifulSoup stripes with inline CSS and javascript content

hey guys doing beautifulSoup css strips and javascript content? after use

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

I still hold them back.

0
python beautifulsoup
source share
1 answer

What exactly do you want to remove 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
source share

All Articles