[Tutor] Newbie question - syntax - BeautifulSoup

Tommy Kaas tommy.kaas at kaasogmulvad.dk
Wed Jul 28 22:58:59 CEST 2010


-----Oprindelig meddelelse-----
Fra: tutor-bounces+tommy.kaas=kaasogmulvad.dk at python.org
[mailto:tutor-bounces+tommy.kaas=kaasogmulvad.dk at python.org] På vegne af
Alan Gauld
Sendt: 28. juli 2010 20:00
Til: tutor at python.org
Emne: Re: [Tutor] Newbie question - syntax - BeautifulSoup


"Tommy Kaas" <tommy.kaas at kaasogmulvad.dk> wrote

> for row in soup('table', {'class' : 'spad'})[0].tbody('tr'):
>
> The example works fine, and I can change it a bit and it still 
> works. But I
> simply don't understand how I am supposed to the fourth line - after 
> "for
> row in soup". I can clearly see it defines the area I want to 
> scrape, but
> how is the syntax build?

Do you understand the syntax from a Python point of view?

No. That's the problem.


> that information myself? I have tried to read the help-file of
> BeautifulSoup, but found nothing there.

Which help file?

Well, maybe not a file, but the text produced by typing: help(BeautifulSoup)



There is a fairly good tutorial for Beautiful Soup here:

http://www.crummy.com/software/BeautifulSoup/documentation.html

Is that the one you meant?

Did you find the section "Searching By CSS class"?

If so we need more specific questionws about what you don't 
understand.
If not, try reading it and then come back for more... :-)

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor at python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list