How I can split this with BeautifulSoup?

<td class="n_td_brand" width="60">147975<br/>07340778</td>

I get this from BeautifulSoup. Then I have to save this like this

list = [147975, 07340778]

When I just access with

soup.select_one(......).text

It shows

14797507340778

Could you share how to do…Thx in advance.

Answer

get_text() will work fine for this:

from bs4 import BeautifulSoup
text = '''<td class="n_td_brand" width="60">147975<br/>07340778</td>'''
soup = BeautifulSoup(text, 'html.parser')
s = list(map(int, soup.td.get_text(' ').split()))
print(s)

Output

[147975, 07340778]

Edit: Modified code to get integer values in list