title: Python webscraping and getting contents of first div tag of its class
body: <p>I'm working with Python 3.3 and this website:
  <a href="http://www.nasdaq.com/markets/ipos/" rel="nofollow">http://www.nasdaq.com/markets/ipos/</a> </p>
  
  <p>My goal is to read only the companies that are in the Upcoming IPO. It is in the div tag with div class="genTable thin floatL" There are two with this class, and the target data is in the first one.  </p>
  
  <p>Here is my code</p>
  
  <pre><code>from urllib.request import urlopen
  from bs4 import BeautifulSoup
  import re
  
  html = urlopen("http://www.nasdaq.com/markets/ipos/").read()
  soup = BeautifulSoup(html)
  for divparent in soup.find_all('div', attrs={'class':'genTable thin floatL'}) [0]: # I tried putting a [0] so it will only return divs in the first genTable thin floatL class
      for div in soup.find_all('div', attrs={'class':'ipo-cell-height'}):
          s = div.string
          if re.match(r'\d{1,2}/\d{1,2}/\d{4}$', s):
              div_next = div.find_next('div')
              print('{} - {}'.format(s, div_next.string))
  </code></pre>
  
  <p>I'd like it to return only</p>
  
  <pre><code>3/7/2014 - RECRO PHARMA, INC.
  2/28/2014 - VARONIS SYSTEMS INC
  2/27/2014 - LUMENIS LTD
  2/21/2014 - SUNDANCE ENERGY AUSTRALIA LTD
  2/21/2014 - SEMLER SCIENTIFIC, INC.
  </code></pre>
  
  <p>But it prints all div classes with the re.match specifications and multiple times as well. I tried inserting [0] on the for divparent loop to retrieve only the first one but this cause the repeating problem instead.</p>
  
  <p>EDIT: Here is the updated code according to warunsl solution. This works.</p>
  
  <pre><code>from urllib.request import urlopen
  from bs4 import BeautifulSoup
  import re
  
  html = urlopen("http://www.nasdaq.com/markets/ipos/").read()
  soup = BeautifulSoup(html)
  
  divparent = soup.find_all('div', attrs={'class':'genTable thin floatL'})[0]
  table= divparent.find('table')
  for div in table.find_all('div', attrs={'class':'ipo-cell-height'}):
          s = div.string
          if re.match(r'\d{1,2}/\d{1,2}/\d{4}$', s):
              div_next = div.find_next('div')
              print('{} - {}'.format(s, div_next.string))
  </code></pre>