1059389705 发表于 2019-12-10 20:09:02

关于BeautifulSoup4 的问题

from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(html_doc, 'html.parser')
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
    soup = BeautifulSoup(html_doc, 'html.parser')
File "C:\Python38-32\lib\site-packages\bs4\__init__.py", line 153, in __init__
    builder = builder_class()
File "C:\Python38-32\lib\site-packages\bs4\builder\_htmlparser.py", line 39, in __init__
    return super(HTMLParserTreeBuilder, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'strict'

1059389705 发表于 2019-12-10 20:11:11

为什么会这样报错啊一直解决不了 上面的from bs4 import BeautifulSoup的没错这是官方的例子

1059389705 发表于 2019-12-11 10:16:41


1059389705 发表于 2019-12-11 21:42:21

1059389705 发表于 2019-12-12 10:56:24

小林2128 发表于 2020-3-10 08:52:29

bs4库没装好吗,还是操作系统有问题?

Levin-e 发表于 2020-3-10 09:44:15

可能你的版本太旧了,试试更新到最新的版本
pip install requests --upgrade
页: [1]
查看完整版本: 关于BeautifulSoup4 的问题