【发布时间】:2020-03-11 02:24:27
【问题描述】:
我正在尝试通过网络抓取板球得分 webiste 以获得记分卡。 但我收到此属性错误:
回溯(最近一次通话最后一次):
**文件“J:/Python Programs/Web Scraper/ESPN Cric Info.py”,第 6 行,在
soup = BeautifulSoup.find(page.content, 'html.parser')
文件“J:\Python Programs\Web Scraper\venv\lib\site-packages\bs4\element.py”,第 1282 行,在查找中 l = self.find_all(name, attrs, recursive, text, 1, ****kwargs**) ** AttributeError: 'bytes' 对象没有属性 'find_all'****
我的代码是:
import requests
from bs4 import BeautifulSoup
page = requests.get('https://www.espncricinfo.com/series/19430/scorecard/1187016/india-vs-bangladesh-1st-test-icc-world-test-championship-2019-2021')
soup = BeautifulSoup.find(page.content, 'html.parser')
scorecard = soup.find(id='gp-inning-01')
print(scorecard)
如果你解决了这将是一个很大的帮助。
【问题讨论】:
-
请显示整个堆栈跟踪。
标签: python web-scraping beautifulsoup html-parsing