I have already submitted a Stackoverflow question 
(https://stackoverflow.com/questions/27115336/issues-looping-over-a-table-in-scrapy)
 
but I thought I'd ask here as well. I have a confusing situation with how 
to loop a selector. The gist of my code is this.

rows = hxs.xpath('//table[@class="t1"]//tr')for row in rows:
    cells = row.xpath('td').extract()

I grab a list of table rows, loop over that and get a list of row cells. The 
preceding code does not work, I get a blank list. However, if instead of 
looping over the selector I pick a selector from the SelectorList using an 
index, it works no problem.

rows = hxs.xpath('//table[@class="t1"]//tr')
cells = rows[1].xpath('td').extract() #this works

So what am I doing wrong? I followed the docs section on Nested selectors and 
that didn't help. There should be no difference between looping a selector and 
indexing it.

-- 
You received this message because you are subscribed to the Google Groups 
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to