0
I’m making a capture of a site using python (scrapy) and xpath
How to capture only 232,990 of the code below?
<div class="price-advantages-container">
<div class="price-comparison">
<div itemprop="price" class="price">
<div>
<span>R$</span> 232.990
</div>
</div>
</div>
</div>
I tried with Response.xpath('//div[contains(@class, "price")]/div/text()') and returned invisible characters like:
[<Selector xpath='//div[contains(@class, "price")]/div/text()' data='\r\n\t\t\t\t\t\t'>,
<Selector xpath='//div[contains(@class, "price")]/div/text()' data='\r\n\t\t\t\t\t\t\t'>,
<Selector xpath='//div[contains(@class, "price")]/div/text()' data='\r\n\t\t\t\t\t\t\t\t'>,
<Selector xpath='//div[contains(@class, "price")]/div/text()' data=' 232.990\r\n\t\t\t\t\t\t\t'>,
<Selector xpath='//div[contains(@class, "price")]/div/text()' data='\r\n\t\t\t\t\t\t'>,
<Selector xpath='//div[contains(@class, "price")]/div/text()' data='\r\n\t\t\t\t\t'>]
Invisible characters will always come. Just make a
.trim()
in string to remove them.– Pedro von Hertwig Batista