Constructing selectors
For convenience,response objects exposes a selector on .selector attribute,it‘s totally ok to use this shortcut when possible.
//怎么构造selector?
response.selector.xpath(‘...‘)可以简写成response.xpath()
xpath()方法返回的是a list of selectors.
在一个xpath()返回的selector中嵌套使用selector,此时//默认是整个文档,要想是相对路径,需要是.//
【Scrapy】Selectors,布布扣,bubuko.com
时间: 2024-10-10 03:14:44