[Tutor] weather scraping with Beautiful Soup
Che M
pine508 at hotmail.com
Fri Jul 17 19:33:03 CEST 2009
> Date: Fri, 17 Jul 2009 12:27:36 +0200
> From: motoom at xs4all.nl
> To: tutor at python.org
> CC: pine508 at hotmail.com
> Subject: Re: [Tutor] weather scraping with Beautiful Soup
>
> Che M wrote:
>
> > The 60.3 is the value I want to extract.
>
> soup.find("div",id="curcondbox").findNext("span","b").renderContents()
Thanks, but that isn't working for me. Here's my code:
---------
import urllib2
from BeautifulSoup import BeautifulSoup
url = "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=43085"
page = urllib2.urlopen(url)
soup = BeautifulSoup(page)
daytemp = soup.find("div",id="curcondbox").findNext("span","b").renderContents()
print "Today's temperature in Worthington is: ", daytemp
---------
When I try this, I get this error:
HTMLParseError: malformed start tag, at line 1516, column 60
Could someone suggest how to proceed?
Thanks.
CM
_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090717/5a5a58bf/attachment.htm>
More information about the Tutor
mailing list