title: Split a HTML document at tag - Python
body: <p>What would be the best way to split a HTML document/string based on the occurrence of the <br/> tag? I have given the solution I currently have below but it seems quite cumbersome and isn't all that easy to read I think. I also experimented with regex's but I'm told I should not use regex's to parse HTML</p>
  
  <pre><code>for i, br in enumerate(soup.findAll('b')):
  line_value = ''
  line_values = []
  next = br.next
  while (next):
      if next and isinstance(next, Tag) and next.name == 'br':
          line_values.append(line_value)
          line_value = ''
      else:
          stripped_text = ''.join(BeautifulSoup(str(next).strip()).findAll(text=True))
          if stripped_text:
              line_value += stripped_text
      next = next.nextSibling
  print line_values
  </code></pre>
  
  <p>Here's a sample of the HTML I'm parsing:</p>
  
  <pre><code>&lt;p&gt;&lt;font size="1" color="#800000"&gt;&lt;b&gt;09:00
    &lt;font&gt; - &lt;/font&gt;
    11:00
    &lt;br&gt;
    CE4817
    &lt;font&gt; - &lt;/font&gt;LAB &lt;font&gt;- &lt;/font&gt;
    2A
    &lt;br&gt;
     B2043 B2042
    &lt;br&gt;
  
    Wks:1-13
    &lt;/b&gt;&lt;/font&gt;
    &lt;/p&gt;
  </code></pre>
  
  <p>And the current results of my code:</p>
  
  <pre><code>[u'09:00 - 11:00', u'CE4817 - LAB- 2A', u'B2043 B2042']
  [u'11:00 - 12:00', u'CE4607 - TUT- 3A', u'A1054']
  </code></pre>