擅长:python、mysql、java
<p>这个任务有一个有用的库(来自Scrapy的创建者),您应该试试:<a href="https://github.com/TeamHG-Memex/html-text" rel="nofollow noreferrer">https://github.com/TeamHG-Memex/html-text</a></p>
<pre><code>import html_text
i_need_text=response.xpath('//div[@class="agency-header__address"]').extract_first()
html_text.extract_text(i_need_text)
</code></pre>
<p>出[4]:“新南威尔士州悉尼布莱街25号18楼,2000”</p>