title: How to remove HTML tags in BeautifulSoup when I have contents
body: <p>The html for what I'm attempting to grab:</p>
  
  <p><code>&lt;div id="unitType"&gt;
       &lt;h2&gt;BB100 &lt;br&gt;v1.4.3&lt;/h2&gt;
   &lt;/div&gt;</code></p>
  
  <p>I have the contents of an <code>h2</code> tag below:</p>
  
  <pre><code>initialPage = beautifulSoup(urllib.urlopen(url).read(), 'html.parser')
  deviceInfo = initialPage.find('div', {'id': 'unitType'}).h2.contents
  print('Device Info: ', deviceInfo)
  for i in deviceInfo:
      print i
  </code></pre>
  
  <p>Which outputs:</p>
  
  <pre><code>('Device Info: ', [u'BB100 ', &lt;br&gt;v1.4.3&lt;/br&gt;])
  BB100
  &lt;br&gt;v1.4.3&lt;/br&gt;
  </code></pre>
  
  <p>How do I remove the <code>&lt;h2&gt;</code>,<code>&lt;/h2&gt;</code>,<code>&lt;br&gt;</code> and <code>&lt;/br&gt;</code> html tags, using BeautifulSoup rather than regex? I've tried <code>i.decompose()</code> and <code>i.strip()</code> but neither has worked. It would throw <code>'NoneType' object is not callable</code>.</p>