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

pydev debugger: starting (pid: 7212)

craw 1,http://baike.baidu.com/item/Python

Traceback (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?


幕布斯9012443
浏览 2412回答 1
1回答

习惯受伤

soup = BeautifulSoup(html_cont,'html_parser',from_encoding='utf-8')这句你改成:soup = BeautifulSoup(html_cont,'html.parser',from_encoding='utf-8')
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python