[EMAIL PROTECTED] writes:
> 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'} ):

If you're using BeautifulSoup, you don't need to pass in the second
dictionary. For that matter, you don't need to pass in the first one -
bs.fetch (which is what calling a tag object calls) will treat a
bare string as a request for a class. On the other hand, I don't like
using the callable objecdt shortcut, and prefer spelling out fetch
explicitly. So you'd write:

for incident in bs.fetch('td', 'rulesbody'):

   <mike


-- 
Mike Meyer <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to