Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 带BS4的HTML解析:无法';找不到树生成器…';html解析器';_Python 3.x - Fatal编程技术网

Python 3.x 带BS4的HTML解析:无法';找不到树生成器…';html解析器';

Python 3.x 带BS4的HTML解析:无法';找不到树生成器…';html解析器';,python-3.x,Python 3.x,在pydev控制台中收到错误后,我无法理解如何继续 控制台正在返回以下内容: b'<!DOCTYPE html>\n<html>\n <head>\n <title>A simple example page</title>\n </head>\n <body>\n <p>Here is some simple content for this pag

在pydev控制台中收到错误后,我无法理解如何继续

控制台正在返回以下内容:

  b'<!DOCTYPE html>\n<html>\n    <head>\n        <title>A simple example page</title>\n    </head>\n    <body>\n        <p>Here is some simple content for this page.</p>\n    </body>\n</html>'
Traceback (most recent call last):
  File "C:\Users\RainShadow\eclipse-workspace\test0\test2.py", line 7, in <module>
    soup = BeautifulSoup(page.content, 'html parser')
  File "C:\Users\RainShadow\Desktop\PythonLibs\BeautifulSoup4\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?

我的问题是在哪里最好地下载具有“html解析器”功能的树生成器

在初始化BS时尝试以下操作:

soup = BeautifulSoup(page.content, 'html.parser')

请注意此处的句点(
),而不是空格。Python随附随附,应将页面解析到您需要的级别。有关更多信息,请参阅。

@SBF12345无需担心!你介意接受我的回答吗?我要得到那个甜蜜的名声:)当然可以,但我该如何去‘接受答案’?我还是stack exchange的新手。@SBF12345:您已成为“会员3年零4个月”,并阅读了()。“提问者可以将一个答案标记为“已接受”。接受并不意味着它是最好的答案,它只是意味着它对提问者有效”(来自同一个人)。这应该可以回答您的问题:。感谢usr2564301!
soup = BeautifulSoup(page.content, 'html.parser')