G
G
gadzhi152016-07-16 21:15:14
Python
gadzhi15, 2016-07-16 21:15:14

Scrapy. How to display the contents of a tag without the tag itself?

Good evening.
There is an HTML page. It has a code

<div class="price">
<strong>
€ 
<span>18.200,-</span>
</strong>

In scrapy I write the following request:
In [47]: response.xpath("//div[@class='price']/strong/span.extract()
Out[47]: ['<span>18.200,-</span>']

That is, I need to output only a number, without span tags. Tried .join but same result

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Abdulla Mursalov, 2016-07-16
@gadzhi15

response.xpath("//div[@class='price']/strong/span/text()".extract()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question