how to remove text between and
using python?
You can use BeautifulSoup with this (and other) methods:
soup = BeautifulSoup(source.lower())
to_extract = soup.findAll('script')
for item in to_extract:
item.extract()
This actually removes the nodes from the HTML. If you wanted to leave the empty tags you'll have to work with the
item
attributes rather than just extracting it from the soup.