I’m trying to scrape a website using beautiful soup. I can navagate to the class object but can’get get down to the next level to get the text I want.
so far I have
soup = BeautifulSoup(urllib2.urlopen('URL...').read())
comment = soup('div', {'class' : 'PanelDarkBackground'})
print comment
which just outputs the entire class (below). I would just like to extract 0-0, which is in tr>td id=”event” section of the code
any suggestions…?
[<div class="PanelDarkBackground" id="Event-Basic-Info" style="margin-bottom: 10px">
<div style="height: 70px; width: 100%;">
<div style="height: 70px; width: 70px; float: left; background-color: white">
<img height="70" src="ss" width="70"/>
</div>
<div style="width: 450px; float: left; height: 70px; display: table">
<table border="0" cellpadding="0" cellspacing="0" style="font-family: tahoma; font-size: 18pt; font-weight: bold; color: white;" width="450px">
<tr>
<td align="center" height="70" style="font-family: tahoma; font-size: 18pt; font-weight: bold; color: white;" valign="middle" width="197">seveal</td>
<td align="center" id="event" style="font-family: tahoma; font-size: 18pt; font- weight: bold; color: white;" valign="middle">0-0</td>
<td align="center" style="font-family: tahoma; font-size: 18pt; font-weight: bold; color: white;" valign="middle" width="197">seveal</td>
</tr>
</table>
</div>
<div style="height: 70px; width: 70px; float: right; background-color: white">
<img height="70" src="" width="70"/>
</div>
</div>
</div>]
Go directly to the
td.For just the contents of the
tdyou can do: