Graphics Programs Reference
In-Depth Information
FIGurE 2-5 HTML source for a page on Weather Underground
As before, this gives you a list of all the occurrences of nobr . The one that
you're interested in is the sixth occurrence, which you can find with the
following:
print nobrs[5]
This gives you the whole element, but you just want the 26 . Inside the
<span> tag with the nobr class is another <span> tag and then the 26 . So
here's what you need to use:
dayTemp = nobrs[5].span.string
print dayTemp
Ta Da! You scraped your first value from an HTML web page. Next step:
scrape all the pages for 2009. For that, return to the original URL.
www.wunderground.com/history/airport/KBUF/2009/1/1/DailyHistory.html
Search WWH ::




Custom Search