擅长:python、mysql、java
<p>您需要使用正则表达式作为文本字段,如<code>re.compile('Residential or')</code>,而不是字符串。在</p>
<p>这对我很有用。我不得不反复查看提供的结果,但是如果您只希望每个页面都有一个结果,您可以将<code>find</code>替换为<code>find_all</code>:</p>
<pre><code>for r in thesoup.find_all(text=re.compile('Residential or')):
r.find_next('td').text
</code></pre>