title: Removing html tags and entities from string in python
body: <p>I am getting xml data from api.careerbuilder.com
  Particularly, the string contains some html entities I am willing to remove, to no effect!</p>
  
  <p>I have tried doing this:</p>
  
  <pre><code>import re
  re.sub('\&amp;amp;lt;.*?\&amp;amp;gt;', '', job_title_text)
  </code></pre>
  
  <p>and this </p>
  
  <pre><code>from html.parser import HTMLParser
  class MLStripper(HTMLParser):
      def __init__(self):
          self.reset()
          self.fed = []
      def handle_data(self, d):
          self.fed.append(d)
      def get_data(self):
          return ''.join(self.fed)
  
  def strip_tags(html):
      s = MLStripper()
      s.feed(html)
      return s.get_data()
  
  strip_tags(job_title_text)
  </code></pre>
  
  <p>and finally this </p>
  
  <pre><code>import lxml.html
  (lxml.html.fromstring(job_title_text)).text_content()
  </code></pre>
  
  <p>But all of these were failures. The second approach deleted html entities like "&amp;amp" but the text inside the tags was left, that is "pbrspan", for example. Third one completely ruined everything, no data was shown at all, instead </p>
  
  <blockquote>
    <p>&lt; bound method HtmlElement.text_content of &lt; Element html at 0x33717d8> ></p>
  </blockquote>
  
  <p>Finally, I suspect, that the regex I have written is entirely wrong.
  Any ideas, how this can be handled?</p>