scrapy:xpath string(.)非常注意问题

text = selector.xpath('//div[@span="ct"]/string(.)').extract_first()
#写成这样是xpath语法错误,而把string(.)单独提出来就可以过
data = selector.xpath('//div[@span="ct"]')
text = data.xpath('string(.)').extract_first()

猜你喜欢

转载自blog.csdn.net/lishk314/article/details/83536463
今日推荐