need help with python syntax

gene tani gene.tani at gmail.com
Sun Dec 25 06:10:36 CET 2005


gene tani wrote:
> homepricemaps at gmail.com wrote:
> > if i have a piece of html that looks like this
> >
> > <tr class="rulesbody">
> > <td width="183" class="rulesbody">cnn.com
> >
> > and i want to scrape out cnn.com , what syntax would i use?  i have
> > tried this and it doesn't work
> >
> > for incident in bs('td', {'class' : 'rulesbody'}, {'class' :
> > 'rulesbody'} ):
>
> Did you try Beautiful soup, as suggested in the reply you got the 1st
> time you posted this question?

sorry, nevermind, you did put forth some effort

myhtml=r'<tr class="rulesbody"> <td width="183"
class="rulesbody">cnn.com </td>'
soup = BeautifulSoup(myhtml)
print soup.td.string




More information about the Python-list mailing list