/在
[使XPath表达式 无效 之前,还需要执行其他操作。去掉它:
//*[@id="quantity"]/option[last()-1]
请注意,您也可以使用Python / Scrapy解决它:
response.xpath('//*[@id="quantity"]/option')[-1].extract()或者,以 CSS选择器 形式:
response.css('#quantity option:last-child').extract_first()response.css('#quantity option')[-1].extract()


