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

只能爬一个网页,第二个就显示failed

用的是python3,求助

正在回答

4 回答

craw 1 : https://baike.baidu.com/item/%E5%90%B4%E4%BA%A6%E5%87%A1/8325774?fr=aladdin
Traceback (most recent call last):
  File "D:\Documents\Downloads\eclipse\eclipse练习\1\kris\spider_main.py", line 53, in <module>
    obj_spider.craw(root_url)
  File "D:\Documents\Downloads\eclipse\eclipse练习\1\kris\spider_main.py", line 28, in craw
    new_urls, new_data = self.parser.parse(new_url, html_cont)
TypeError: 'NoneType' object is not iterable

请问各位大神  这个问题什么意思

0 回复 有任何疑惑可以回复我~

同样遇到你这个问题,重新看了一遍老师的视频,发现是自己写错了,把soup = BeautifulSoup(html_cont, 'html_parser', from_encoding='utf-8')改为soup = BeautifulSoup(html_cont, 'html.parser', from_encoding='utf-8')就可以啦

0 回复 有任何疑惑可以回复我~

crawl 1 : https://baike.baidu.com/item/Python/407313?fr=aladdin

Traceback (most recent call last):

  File "D:\Eclipse\project\crawl\school\spider_main.py", line 39, in <module>

    obj_spider.craw(root_url)

  File "D:\Eclipse\project\crawl\school\spider_main.py", line 23, in craw

    new_urls, new_data = self.parser.parse(new_url, html_cont)

  File "D:\Eclipse\project\crawl\school\html_parser.py", line 41, in parse

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

  File "build\bdist.win-amd64\egg\bs4\__init__.py", line 165, in __init__

    

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html_parser. Do you need to install a parser library?

什么原因

0 回复 有任何疑惑可以回复我~

先不要写在try块里面,这样可以看到哪错了

3 回复 有任何疑惑可以回复我~
#1

weixin_慕慕4455050

实话,靠你说的我才发现问题所在
2019-01-10 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Python开发简单爬虫
  • 参与学习       227670    人
  • 解答问题       1219    个

本教程带您解开python爬虫这门神奇技术的面纱

进入课程

只能爬一个网页,第二个就显示failed

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信