title: Python, remove all html tags from string
body: <p>I am trying to access the article content from a website, using beautifulsoup with the below code:</p>
  
  <pre><code>site= 'www.example.com'
  page = urllib2.urlopen(req)
  soup = BeautifulSoup(page)
  content = soup.find_all('p')
  content=str(content)
  </code></pre>
  
  <p>the content object contains all of the main text from the page that is within the 'p' tag, however there are still other tags present within the output as can be seen in the image below. I would like to remove all characters that are enclosed in matching pairs of &lt; > tags and the tags themselves. so that only the text remains.</p>
  
  <p>I have tried the following  method, but it does not seem to work.</p>
  
  <pre><code>' '.join(item for item in content.split() if not (item.startswith('&lt;') and item.endswith('&gt;')))
  </code></pre>
  
  <p>What is the best way to remove substrings in a sting? that begin and end with a certain pattern such as &lt; > </p>
  
  <p><a href="https://i.stack.imgur.com/ozJoB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ozJoB.png" alt="enter image description here"></a></p>