【问题标题】:Extracting table data using Selenium and Python使用 Selenium 和 Python 提取表数据
【发布时间】:2020-10-23 02:23:47
【问题描述】:

我正在从事一个从网站上抓取表格的项目。我无法提供完整的代码,因为这是一个登录的公司特定站点。 基本上,我正在尝试从存在不超过 100 条记录但一次只显示 12 条记录的 webtable 中获取记录。我尝试使用滚动条获取记录,但它失败了。请帮助我获取所有记录在excel表中。提前致谢。 我在下面添加我的代码。

from lxml import etree
import urllib.request
import requests
import pandas as pd
from bs4 import BeautifulSoup
url = "https//"
pd.read_html(requests.get(url,verify=False))
df = pd.read_html(url)

我遇到以下错误:

TypeError: 无法从“响应”解析

【问题讨论】:

    标签: python pandas dataframe web-scraping beautifulsoup


    【解决方案1】:

    你需要改变

    pd.read_html(requests.get(url,verify=False))

    pd.read_html(requests.get(url,verify=False).content)
    

    【讨论】:

    • 您好,感谢您的帮助!我们尝试了您已经提供的解决方案,但在使用 pd.read_html(requests.get(url,verify=False).content) 后出现“未找到表”的错误,请您进一步指导我们。
    • 您确定您的网页上有<table> 标签吗?另外,检查这个答案 - stackoverflow.com/questions/53398785/…
    猜你喜欢
    • 2021-01-07
    • 2020-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 2020-12-16
    • 1970-01-01
    • 2021-06-23
    相关资源
    最近更新 更多