擅长:python、mysql、java
<p>如果知道wingding字符的位置不会改变,可以使用<code>.next</code>。在</p>
<pre><code>>>> nodes = soup.findAll(text=re.compile('[sS]maller.*[rR]eporting.*[cC]ompany'))
>>> nodes[-1].next.next # last item in list is the only good one... kinda crap
u'&#254;'
</code></pre>
<p>或者你可以上去,然后<code>find</code>从那里:</p>
^{pr2}$
<p>或者你也可以反过来:</p>
<pre><code>>>> soup.findAll(text='&#254;')[0].previous.previous
u' Smaller reporting company '
</code></pre>
<p>假设你知道你要找的翅膀特征。在</p>
<p>最后一个策略还有一个额外的好处,就是过滤掉正则表达式捕捉到的其他垃圾,我想你并不真的想要;然后你可以循环查看结果,知道你只在正确的列表中工作,这样你就可以随心所欲地阅读<code>if</code>。在</p>