scrapy的extract() 、extract_first()方法,get() 、getall() 方法
1.extract()方法:
def parse(self, response):
sel = Selector(response)
hrefs = sel.xpath(r'//*[@class="c1 ico2"]/li/a/@href')
print(hrefs.extract())
结果如下:
['/4253340.html', '/6135617.html', '/5786549....
原创
2020-04-26 18:12:39 ·
4968 阅读 ·
4 评论