首页 > 解决方案 > 有什么方法可以获取每只股票(200+)的所有季度业绩数据并使用 python 将其存储在 excel 中?

问题描述

网站链接:http: //opstra.definedge.com/historical-results-timings。因此,每个相应股票都有季度结果日期,我想将相应股票的每个日期存储在 excel 中。我是 python 新手,因此不知道如何通过网络抓取它。我试过但没有工作。下面是代码:

从 selenium 导入 webdriver 从 selenium.webdriver.support.ui 导入选择

driver=webdriver.Chrome("C:\Users\DELL\Documents\Python_module\chromedriver.exe") driver.get("http://opstra.definedge.com/historical-results-timings")

driver.maximize_window()

#obj=Select(driver.find_element_by_id("searchLanguage")) #obj.select_by_index(0)

obj=Select(driver.find_element_by_class("v-input_slot")) obj.select_by_index(10)

标签: pythonwebweb-scraping

解决方案


简短的回答:是的,这是可能的。

长答案:Python 提供了许多库来像BeatifulSoup一样从 Web 上抓取数据,并像XlsxWriter一样编写 Excel 。

但是,我想您也可以找到一个 API 来收集数据,而无需使用抓取技术。


推荐阅读