Scrapy可以获取到标题但是无法获取到价格

img


    def parse(self, response):
        print(response, response.url, '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-')
        sections = response.xpath('.//section[@class="list"][1]/div')
        print(len(sections))

        for section in sections:
            title = section.xpath('./a/div[2]/div[1]/div/h3/@title').extract_first()
            total_price = section.xpath('/a/div[2]/div[2]/p[1]/span/text()').extract
            print(title, '\n', total_price )

img

p[0]吧,或者你直接用class查找不香吗