Re: [Tutor] Using Beautiful Soup to find an HTML element by its class attribute

2010-05-30 Thread Sithembewena Lloyd Dube
Thanks all, I found the solution: using the attributes dictionary as follows: weather_row = soup.findAll('tr', { "class" : "rs1" }) Many thanks. On Mon, May 31, 2010 at 1:32 AM, Sithembewena Lloyd Dube wrote: > Hi everyone, > > I am using urllib to scrape an HTML page, and creating an instance

[Tutor] Using Beautiful Soup to find an HTML element by its class attribute

2010-05-30 Thread Sithembewena Lloyd Dube
Hi everyone, I am using urllib to scrape an HTML page, and creating an instance of BeautifulSoup as follows: * *from BeautifulSoup import BeautifulSoup import re, urllib doc = urllib.urlopen(my_url).read() soup = BeautifulSoup(''.join(doc)) #print soup.prettify() weather_row = soup.findAll('tr',

[Tutor] Using Beautiful Soup to find an HTML element by its class attribute

2010-05-30 Thread Sithembewena Lloyd Dube
Hi everyone, I am using urllib to scrape an HTML page, and creating an instance of BeautifulSoup as follows: * *from BeautifulSoup import BeautifulSoup import re, urllib doc = urllib.urlopen(" http://weather.za.msn.com/local.aspx?wealocations=wc:SFXX0010&q=Cape+Town%2c+Western+Cape ").read() soup