Итак, у меня есть этот html:
<html>
<p>
This is my first sentence
<br>
This sentance should be considered as part of the first one.
<br>
And this also
</p>
<p>
This is the second sentence
</p>
</html>
Я хочу извлечь текст из узлов p, весь текст в одном узле должен быть возвращен как один элемент, я использую оболочку scrapy, как это:
scrapy shell path/to/file.html
response.xpath('//p/text()').extract()
вывод, который я получаю:
[
'This is my first sentence',
'This sentance should be considered as part of the first one.'
'And this also'
'This is the second sentence'
]
вывод, который я хочу:
[
'This is my first sentence This sentance should be considered as part of the first one And this also'
'This is the second sentence'
]
Любая помощь о том, как решить эту проблему с помощью выражения xpath
Большое спасибо:))))