【发布时间】:2015-11-11 01:07:08
【问题描述】:
beautifulsoup 似乎有问题,无论我搜索什么,它都不会返回任何东西。示例:
from BeautifulSoup import BeautifulSoup
import urllib2
url="http://www.google.com"
html=urllib2.urlopen(url).read()
print type(html)
soup= BeautifulSoup(html)
soup.find_all('div')
返回:
C:\Users\Alexis\Desktop>ipython scrape.py
<type 'str'>
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
C:\Users\Alexis\Desktop\scrape.py in <module>()
7 print type(html)
8 soup= BeautifulSoup(html)
----> 9 soup.find_all('div')
10
11
TypeError: 'NoneType' object is not callable
我已尝试升级到最新版本。没有变化。
【问题讨论】:
标签: beautifulsoup