title: Splitting HTML text by <br> while using beautifulsoup
body: <p>HTML code:</p>
  
  <pre><code>&lt;td&gt; &lt;label class="identifier"&gt;Speed (avg./max):&lt;/label&gt; &lt;/td&gt; &lt;td class="value"&gt; &lt;span class="block"&gt;4.5 kn&lt;br&gt;7.1 kn&lt;/span&gt; &lt;/td&gt;
  </code></pre>
  
  <p>I need to get values 4.5 kn and 7.1 as separate list items so I could append them separately. I do not want to split it  I wanted to split the text string using re.sub, but it does not work. I tried too use replace to replace br, but it did not work. Can anybody provide any insight?</p>
  
  <p>Python code:</p>
  
  <pre><code>  def NameSearch(shipLink, mmsi, shipName):
      from bs4 import BeautifulSoup
      import urllib2
      import csv
      import re
  
      values = []
      values.append(mmsi)
      values.append(shipName)
      regex = re.compile(r'[\n\r\t]')
      i = 0
      with open('Ship_indexname.csv', 'wb')as f:
          writer = csv.writer(f)
          while True:
              try:
                  shipPage = urllib2.urlopen(shipLink, timeout=5)
              except urllib2.URLError:
                  continue
              except:
                  continue
              break
          soup = BeautifulSoup(shipPage, "html.parser")  # Read the web page HTML
          #soup.find('br').replaceWith(' ')
          #for br in soup('br'):
              #br.extract()
          table = soup.find_all("table", {"id": "vessel-related"})  # Finds table with class table1
          for mytable in table:                                   #Loops tables with class table1
              table_body = mytable.find_all('tbody')                  #Finds tbody section in table
              for body in table_body:
                  rows = body.find_all('tr')                #Finds all rows
                  for tr in rows:                                 #Loops rows
                      cols = tr.find_all('td')                    #Finds the columns
                      for td in cols:                             #Loops the columns
                          checker = td.text.encode('ascii', 'ignore')
                          check = regex.sub('', checker)
                          if check == ' Speed (avg./max): ':
                              i = 1
                          elif i == 1:
                              print td.text
                              pat=re.compile('&lt;br\s*/&gt;')
                              print pat.sub(" ",td.text)
                              values.append(td.text.strip("\n").encode('utf-8'))  #Takes the second columns value and assigns it to a list called Values
                              i = 0
      #print values
      return values
  
  
  NameSearch('https://www.fleetmon.com/vessels/kind-of-magic_0_3478642/','230034570','KIND OF MAGIC')
  </code></pre>