【发布时间】:2021-10-17 17:17:52
【问题描述】:
全新的程序员。
尝试使用下面的类来抓取特定方面。 There are 5 in total 在检查窗口中。当我尝试打印第三个索引时,它给了我一个“超出范围”的错误。有什么线索吗?
import bs4
from bs4 import BeautifulSoup
import requests
import lxml
vegas_insider = requests.get('https://www.vegasinsider.com/college-football/matchups/', 'r').text
soup = BeautifulSoup(vegas_insider, 'lxml')
closing_line = soup.find('td', class_ = 'viCellBg2 cellBorderL1 cellTextNorm padCenter').text[2]
print(float(closing_line))
【问题讨论】:
标签: python python-3.x web-scraping indexing