读书人

beautifulsoup的有关问题

发布时间: 2013-04-09 16:45:09 作者: rapoo

beautifulsoup的问题
from bs4 import BeautifulSoup
html_src=urllib.urlopen('http://bj.meituan.com/').read()
soup = BeautifulSoup(''.join(html_src))
soup.findall('div')

报错TypeError: 'NoneType' object is not callable
[解决办法]
soup = BeautifulSoup(''.join(html_src)) -> soup = BeautifulSoup(html_src)
soup.findall('div') -> soup.find_all('div')

读书人网 >perl python

热点推荐