July 2, 2010
8:49 a.m.
Hi, I am experimenting with web scraping using lxml. I have played a little with BeautifulSoup in the past and scrapy recently. I am recoding something I did with scrapy with lxml but encounter a problem I am not sure how to iron out. With scrapy, hxs is an xpath selector which has a select and re method types = hxs.select('.//a[@href]/@href').re(r'type=([A-Z]*)') Which will return a list of the matches in href. How would I do the same thing with lxml? types = doc.xpath('.//a[@href]/@href') ... Thanks a lot, -- EuGeNe -- I lend my books on COlivri http://www.colivri.org/user/eugene, do you?