title: Python and BeautifulSoup4 - Extract Text from TD tags
body: <p>I am stuck after looking through many other questions. My code currently is breaking the data into named rows, but is returning the entire line instead of just the text included, I am just looking for ASCO VALVE MFG., INC. from the following line:  I am not sure how to pull out just that text from the row. </p>
  
  <pre><code>&lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;****ASCO VALVE MFG., INC.****&lt;/font&gt;&lt;/td&gt;
  </code></pre>
  
  <p>My input looks like:
  Headers:</p>
  
  <pre><code> &lt;tr&gt;
          &lt;td align="center" id="ColHead_0"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;WH&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_1"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;OrderNo.&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_2"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;Cust.&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="left" id="ColHead_3"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;Customer Name&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_4"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;Item Number&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_5"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;Item Description 1&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_6"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;Item Description 2&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_7"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;Qty&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
          &lt;td align="center" id="ColHead_8"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;&lt;b&gt;S/N &lt;/b&gt;&lt;/font&gt;&lt;/td&gt;
        &lt;/tr&gt;
  </code></pre>
  
  <p>Data rows are as below:</p>
  
  <pre><code>&lt;tr&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;09&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;92427&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;20668&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;ASCO VALVE MFG., INC.&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;EQPRAN77333&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;RANPAK FILLPAK TT&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;S/N 50742543&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="right"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;1&lt;/font&gt;&lt;/td&gt;
       &lt;td nowrap="nowrap" align="left"&gt;&lt;font size="3" face="Arial,Helvetica,sans-serif"&gt;50742543&lt;/font&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>My code currently is breaking the data into named rows, but is returning the whole html line. </p>
  
  <pre><code>soup1 = BeautifulSoup(output, "html.parser")
  find_string = soup1.body.find_all(text="-")
  Customer_No = []
  Serial_No = []
  rows = soup1.find_all("tr")
  title = rows[0]
  headers = rows[1]
  datarows = rows[2:]
  
  for row in datarows :
      if len(row)&gt; 7:
          WHID = row.contents[1]
          ORNO = row.contents[3]
          CSNO = row.contents[5]
          CSNM = row.contents[7]
          ITNO = row.contents[9]
          DESC = row.contents[11]
          DESC2 = row.contents[13]
          QTY = row.contents[15]
          SN = row.contents[17]
          print ITNO
      else:
          continue
  </code></pre>
  
  <p>What I am trying to end up with is a dictionary I guess of [text in CSNO] and [text in SN] pairs to match with a 2nd CSV file.  I hope that all makes sense. </p>