擅长:python、mysql、java
<p>以防有人碰到这个问题。美组现在支持:</p>
<pre><code>Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
In [1]: import bs4
In [2]: soup = bs4.BeautifulSoup('<div class="foo bar"></div>')
In [3]: soup(attrs={'class': 'bar'})
Out[3]: [<div class="foo bar"></div>]
</code></pre>
<p>而且,你不必再输入findAll了。</p>