from bs4 import BeautifulSoup txt = """<p>I have a dog. His name is <span class="secret">Ken</span>.</p>""" soup = BeautifulSoup(txt) # This keeps "unwanted" information soup.get_text() # : u'I have a dog. His name is Ken.' # remove an element by tag matching soup.find("span", {"class":"secret"}).extract() soup.get_text() # : u'I have a dog. His name is .' # or you can replace that with something