【发布时间】:2020-06-09 19:01:52
【问题描述】:
python 新手并尝试进行基本的网络抓取。我的代码与错误消息一起在下面。我花了好几个小时才弄清楚为什么当我把它从互联网上拉下来时会出错。任何帮助将不胜感激。
import requests
from bs4 import BeautifulSoup
page = requests.get('https://forecast.weather.gov/MapClick.php?lat=33.93680995224785&lon=-118.24891999999994#.Xt_LOzpKiUk')
soup = BeautifulSoup(page.text, 'html.parser')
print(soup)
文件 "C:\Users\mariomanfredi\Anaconda\newupload\lib\site-packages\bs4\builder_htmlparser.py", 第 325 行,在 init 中 super(HTMLParserTreeBuilder, self).init(**kwargs)
TypeError: super(type, obj): obj must be an instance or subtype of 输入
【问题讨论】:
-
在我的机器上运行良好,您的依赖项安装正确吗?
-
更新您的 bs4 和请求,您使用的是什么 python 版本?
标签: python beautifulsoup