title: How to scrape HTML divs that are not children of another div?
body: <p>I have HTML files. for each file, I want to scrape all tables one by one and still have the index of the table to use for getting title and some text before the table.</p>
  <p>I used <code>soup.find_all('divs')</code> to pull all divs and based on the results I built my application.</p>
  <p>When I tried a different HTML file with slightly different format like this:</p>
  <pre><code>&lt;div style=&quot;margin-top:27.85pt;margin-bottom:21.86pt;margin-left:69.66pt;width:456pt;&quot;&gt;
  &lt;div style=&quot;text-align:center; width:456pt; line-height:14pt;font-weight:bold;color:#33058D;font-size:12pt;&quot;&gt;UNITED STATES&lt;br/&gt;SECURITIES AND EXCHANGE COMMISSION&lt;br/&gt;Washington, D.C. 20549&lt;font style=&quot;font-weight:normal;color:#3D3935;font-family:Times New Roman, Times, serif ;letter-spacing:0.24pt;&quot;&gt; &lt;/font&gt;&lt;/div&gt;
  &lt;div style=&quot;margin-top:12pt; text-align:center; width:456pt; line-height:14pt;font-weight:bold;color:#33058D;font-size:12pt;&quot;&gt;SCHEDULE 14A&lt;font style=&quot;font-weight:normal;&quot;&gt; &lt;/font&gt;&lt;/div&gt;
  &lt;div style=&quot;margin-top:8pt; text-align:center; width:456pt; line-height:11pt;&quot;&gt;Proxy Statement Pursuant to Section&amp;#160;14(a) of &lt;br/&gt;the Securities Exchange Act of 1934&lt;font style=&quot;font-family:Times New Roman, Times, serif ;letter-spacing:0.18pt;&quot;&gt; &lt;/font&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>It contains 1 div (parent) and 3 child divs.
  <code>soup.find_all('div')</code> returns 4 items: 1 parent div with children and each children div in the main div.</p>
  <p>I want it to pull the parent div only.</p>
  <pre><code>divs = []
  while len(html) &gt; 0:
      soup = BeautifulSoup(html, 'lxml')
      div = soup.find('div')
      divs.append(div)
      length = len(str(div))
      html = html[:len(html)-length]
  </code></pre>
  <p>I tried creating this code but it was very very inefficient although the result was exactly as I wanted. It took very long time to finish.</p>