为了账号安全,请及时绑定邮箱和手机立即绑定

只显示查到一行 ,然后就失败,去掉try后显示如下错误!

只显示查到一行 ,然后就失败,去掉try后显示如下错误!

幕布斯9012443 2017-02-06 13:57:55
pydev debugger: starting (pid: 7212)craw 1,http://baike.baidu.com/item/PythonTraceback (most recent call last):  File "D:\eclipse-standard_downza\eclipse\plugins\org.python.pydev_3.9.0.201411111611\pysrc\pydevd.py", line 2183, in <module>    globals = debugger.run(setup['file'], None, None)  File "D:\eclipse-standard_downza\eclipse\plugins\org.python.pydev_3.9.0.201411111611\pysrc\pydevd.py", line 1622, in run    pydev_imports.execfile(file, globals, locals)  # execute the script  File "D:\workspase\imooc\baike_spider\spider_main.py", line 41, in <module>    obj_spider.craw(root_url)  File "D:\workspase\imooc\baike_spider\spider_main.py", line 25, in craw    new_urls,new_data=self.parser.parse(new_url,html_cont)  File "D:\workspase\imooc\baike_spider\html_parser.py", line 35, in parse    soup = BeautifulSoup(html_cont,'html_parser',from_encoding='utf-8')  File "C:\Python27\lib\site-packages\bs4\__init__.py", line 165, in __init__    % ",".join(features))bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html_parser. Do you need to install a parser library?
查看完整描述

1 回答

?
习惯受伤

TA贡献885条经验 获得超1144个赞

soup = BeautifulSoup(html_cont,'html_parser',from_encoding='utf-8')

这句你改成:

soup = BeautifulSoup(html_cont,'html.parser',from_encoding='utf-8')


查看完整回答
1 反对 回复 2017-02-06
  • 幕布斯9012443
    幕布斯9012443
    修改以后 没有报错 但是显示一条结果 pydev debugger: starting (pid: 3528) craw 1,http://baike.baidu.com/item/Python
  • 1 回答
  • 0 关注
  • 2409 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信