【发布时间】:2022-01-21 10:01:43
【问题描述】:
文字就像
<tag>Head Office41-43 Ricketts Road<tag/> <tag>Mount Waverley, Melbourne<tag/>
我得到的结果是
Head Office41-43 Ricketts RoadMount Waverley, Melbourne
但我想要它
Head Office41-43 Ricketts Road Mount Waverley, Melbourne
我使用的代码是
response.xpath('string(normalize-space(//*/text()[contains(normalize-space(), "{}")]/../..))'.format(marker))
其中标记是文本。
所以我想要Road Mount而不是RoadMount
查看包装的标签: enter image description here
这是我正在使用的代码 enter image description here
【问题讨论】:
标签: xpath xpath-2.0 normalize-space