title: How to extract text between <h1></h1> in Python?
body: <p>I'm stuck extracting text between <code>&lt;h1&gt;</code> and <code>&lt;/h1&gt;</code>.</p>
  
  <p>Please help me.</p>
  
  <p>My code is:</p>
  
  <pre><code>import bs4
  import re
  import urllib2
  
  url2='http://www.flipkart.com/mobiles/pr?sid=tyy,4io&amp;otracker=ch_vn_mobile_filter_Top%20Brands_All#jumpTo=0|20'
  htmlf = urllib2.urlopen(url2)
  soup = bs4.BeautifulSoup(htmlf)
  #res=soup.findAll('div',attrs={'class':'product-unit'})
  for res in soup.findAll('a',attrs={'class':'fk-display-block'}):
      suburl='http://www.flipkart.com/'+res.get('href')
      subhtml = urllib2.urlopen(suburl)
      subhtml = subhtml.read()
      subhtml = re.sub(r'\s\s+','',subhtml)
      subsoup=bs4.BeautifulSoup(subhtml)
      res2=subsoup.find('h1',attrs={'itemprop':'name'})
      if res2:
          print res2
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>&lt;h1 itemprop="name"&gt;Moto G&lt;/h1&gt;
  &lt;h1 itemprop="name"&gt;Moto E&lt;/h1&gt;
  &lt;h1 itemprop="name"&gt;Moto E&lt;/h1&gt;
  </code></pre>
  
  <p>But I want this:</p>
  
  <pre><code>Moto G
  Moto E
  Moto E
  </code></pre>