Re: [Tutor] beautifulSoup and .next iteration

2007-04-15 Thread Jon Crump
Daniel, It was kind of you to respond, and your response was a model of clarity. You correctly surmised from my awkward framing of the question, that what I wanted was a list of sibling elements between one named anchor and the next. My problem was, in part, that I still don't think in terms of

Re: [Tutor] beautifulSoup and .next iteration

2007-04-13 Thread Daniel Yoo
> anchors = soup.findAll('a', { 'name' : re.compile('^A.*$')}) > for x in anchors: >print x >x = x.next >while getattr(x, 'name') != 'a': > print x > And get into endless loops. I can't help thinking there are simple and > obvious ways to do this, probably many, but as a rank beg

[Tutor] beautifulSoup and .next iteration

2007-04-05 Thread Jon Crump
As a complete tyro, I've broken my teeth on this web-page scraping problem. I've several times wanted to scrape pages in which the only identifying elements are positional rather than syntactical, that is, pages in which everything's a sibling and there's no way to predict how many sibs there a