2009/7/17 Che M <pine...@hotmail.com>:
> table = soup.find("td",id="dataTable tm10")

Almost right. attrs should normall be a dict so {'class':'dataTable
tm10'} but you can use a shortcut, read on.

> ------------------------
>
> When I look at the page source for that page, there is this section, which
> contains the "dataTable tm10" table I want to zoom in on:
>
> ------------
> <table cellspacing="0" cellpadding="0" class="dataTable tm10">
>               <thead>
>               <tr>
>               <td style="width: 25%;">&nbsp;</td>
>               <td>Current:</td>
>               <td>High:</td>
>               <td>Low:</td>
>               <td>Average:</td>
>               </tr>
>               </thead>
>               <tbody>
>               <tr>
>               <td>Temperature:</td>
>               <td>
>   <span class="nobr"><span class="b">73.6</span>&nbsp;&#176;F</span>
> </td>
>               <td>
>   <span class="nobr"><span class="b">83.3</span>&nbsp;&#176;F</span>
> </td>
>               <td>
>   <span class="nobr"><span class="b">64.2</span>&nbsp;&#176;F</span>
> </td>
>               <td>
>   <span class="nobr"><span class="b">74.1</span>&nbsp;&#176;F</span>
> </td>
> --------------

The tag you are looking for is table not td. The tag td is inside the
table tag. So with shortcut it looks like,

table = soup.find("table","dataTable tm10")

or without shortcut,

table = soup.find("table",{'class':'dataTable tm10'})

Greets
Sander
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to