[Tutor] BeautifulSoup - getting cells without new line characters

jonasmg at softhome.net jonasmg at softhome.net
Fri Mar 31 17:25:21 CEST 2006


 From a table, I want to get the cells for then only choose some of them. 

<table>
<tr>
<td>WY</td>
<td>Wyo.</td>
</tr>
...
</table> 

Using: 

for row in table('tr'): print row.contents 

   ['\n', <td>WY</td>, '\n', <td>Wyo.</td>, '\n']
   [...] 

I get a new line character between each cell. 

Is possible get them without those '\n'? 

Thanks in advance! 


More information about the Tutor mailing list