简体   繁体   中英

Scrapy response.xpath how to get the number output

I want to get in Scrapy a numeric value instead of text. Please see in the code "result-number-lg btn-number-details" - the output 0156 numeric value. How do I do it?

I have try

response.xpath('//span[contains(@data-prize-type,"1")]/text()').getall()

the output is {FirstPrize} instead of 0156.

0156

enter image description here

FirstPrize

你可以试试这个:

response.xpath('(//div[@class="result-content"]/span)[2]/text()').getall()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM