Beautifulsoup returns data as None, which include the tag

I have table data like this:

<table class="tablesorter" id="dea">
<thead>
<tr>
<th class="header ">Name</th>
<th class="header">City</th>
<th class="">Address</th>
<th class="">Phone Nos</th>
<th class="">Email</th>
<th class="">Fax</th>
</tr>
</thead>
<tbody>

<tr class="info">
<td style="font:bold 12px Tahoma; color:#1f2c48;">Audi California</td>
<td>&nbsp;California&nbsp;</td>
<td align="left">
A?85, bay Area, Phase 1, <br>
California<br>
California
- 6554655
</td>
<td align="right">
<br>4747744747<br>108388383
</td>
<td align="center">
info<!-- >@_ -->@<!-- >@_ -->audiCal<!-- >@_ -->.<!-- >@_ -->net
</td>
<td align="right">
&nbsp;
</td>
</tr></tbody>
</table>

I use beautifulsoup to parse this, but now I am having trouble retrieving data from the last four <td>. Whenever I read their values ​​using a property .string, I get Noneas a value. I think this is because they have tags <br>. I need the last four <td>data that have an address, phone number, email_id and fax. Instead, .stringwhat should I use to get all this data?

+5
source share
2 answers

You can use .textto get text.

Edit:

.contents .

+4

td, :

 td.findAll(text=True) 

td. join ,

0

All Articles