Home>

If I want to scrape a newline character when scraping with python
I am thinking.

<table>
<div>
                    <tr>
                      <td rowspan = "4">
                        54
                        <br>11.77
                        <br>30.77
                      </td>
                     </tr>
        </div>
                </table>


It is structured as above, (omitted because it is long)
I wrote the following code to scrape this:

from bs4 import BeautifulSoup
import requests
import pandas as pd
from pandas import Series, DataFrame
NF = []
url = 'aaaa'
result = requests.get (url)
c = result.content
soup = BeautifulSoup (c, 'lxml')
summary = soup.find ('div', {'class': 'contentsFrame1_inner'})
table = summary.find_all ('table')
rows = table [1] .find_all ('tr')
for tr in rows:
    cols = tr.find_all ('td', {'class': 'is-lineH2'})
    for td in cols:
        text = td.find (text = True)
        NF.append (text)


When I wrote the code above,
<td class ="is-lineH2"rowspan ="4">
54
<br>11.77
<br>30.77
</td>
</tr>
'54'was on the list,
delimited by<br>
'11.77'
'30.77'
Was not on the list.
Can you tell me how to scrape to<br> ;?