【发布时间】:2019-01-03 13:50:07
【问题描述】:
我一直在学习如何使用 BeautifulSoup 抓取 greatschools.org 网站。尽管在这里和其他地方查找了不同的解决方案,但我已经陷入了死胡同。 通过使用 chrome 上的“检查”功能,我可以看到该网站有表格标签,但 find_all('tr') 或 find_all('table') 或 find_all('tbody') 返回一个空列表。我错过了什么?
这是我正在使用的代码块:
import requests
from bs4 import BeautifulSoup
url = "https://www.greatschools.org/pennsylvania/bethlehem/schools/?
tableView=Overview&view=table"
page_response = requests.get(url)
content = BeautifulSoup(page_response.text,"html.parser")
table=content.find_all('table')
table
输出为:[]
提前感谢您的帮助。
【问题讨论】:
标签: python beautifulsoup