【发布时间】:2011-06-08 13:23:54
【问题描述】:
我正在 linux 中尝试此代码并给出空输出。 我刚刚处理并粘贴了 BS 文档
import urllib2
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup("""Bob's <b>Bold</b> Barbeque Sauce now available in
<b class="hickory">Hickory</b> and <b class="lime">Lime</a>""")
soup.find("b", { "class" : "lime" })
输出为空
【问题讨论】:
-
soup.find("b", { "class" : "lime" }).contents 似乎工作得很好
标签: python linux beautifulsoup