【发布时间】:2014-05-06 23:54:15
【问题描述】:
我正在尝试解析 this site,但由于我无法理解的原因,什么都没有发生。
url = 'http://www.zap.com.br/imoveis/rio-de-janeiro+rio-de-janeiro/apartamento-padrao/venda/'
response = urllib2.urlopen(url).read()
doc = BeautifulSoup(response)
divs = doc.findAll('div')
print len(divs) # prints 0.
这个网站是巴西里约热内卢的一个房地产广告。我在 html 源代码中找不到任何可能阻止 Beautifulsoup 工作的东西。会是大小吗?
我正在使用 Enthought Canopy Python 2.7.6、IPython Notebook 2.0、Beautifulsoup 4.3.2。
【问题讨论】:
-
同样的代码非常适合我,它显示 560...
-
使用下面的提示,我的环境只适用于 'html.parser' 配置。
标签: python html python-2.7 html-parsing beautifulsoup