3 ms·
for script in soup_obj(["script", "style"]): script.extract() # Only need these two elements from the BS4 object That comment is a bit misleading.
by jefb 12y ago
for script in soup_obj(["script", "style"]):
script.extract() # Only need these two elements from the BS4 object
That comment is a bit misleading. soup.extract() will remove those tags from the tree, 'script' and 'style' are the two tags you __don't__ need.
http://www.crummy.com/software/BeautifulSoup/bs4/doc/#extract http://www.crummy.com/software/BeautifulSoup/bs4/doc/#extrac...