1.extract()方法:
结果如下:
结论:说明了extract()方法返回的是符合要求的所有的数据,存在一个列表里。
2.extract_first()方法:
def parse(self, response):
sel = Selector(response)
hrefs = sel.xpath(r'//*[@class="c1 ico2"]/li/a/@href')
print(hrefs.extract_first())
结果如下:
'/4253340.html'
1
结论:说明了extract_first()方法返回的hrefs 列表里的第一个数据。
3.get()方法:
def parse(self, response):
sel