from bs4 import BeautifulSoup
dat = """
<table>
    <tr>
        <td class="xyz">
            text 1
            <br>
            text 2
        </td>
        <td class="xyz">
            text 1
        </td>
    </tr>
</table>
"""
soup = BeautifulSoup(dat, 'html.parser')
for td in soup.select('table > tr > td.xyz'):
    pass
Python to CSV is splitting string into two columns when I want one