我在parse函數下像平時一樣使用xpath語句,結果得到的不是想要的文本信息,而是:"<Selector xpath='//div[@class=\"photo-info\"]/span[@class=\"pb-10\"]/text()' data='想要的文本信息'>"在單獨的py文件中運行就可以得到該文本信息,這是問什么呢?部分代碼如下:def parse(self, response): self.actress_name = response.xpath('//div[@class="photo-info"]/span[@class="pb-10"]/text()')[0] le = LinkExtractor(restrict_xpaths='//*[@class="item"]/a') for link in le.extract_links(response): yield Request(link.url,callback=self.parse_detail)
添加回答
舉報
0/150
提交
取消