python - 有什么方法可以获取每只股票(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)
解决方案
简短的回答:是的,这是可能的。
长答案:Python 提供了许多库来像BeatifulSoup一样从 Web 上抓取数据,并像XlsxWriter一样编写 Excel 。
但是,我想您也可以找到一个 API 来收集数据,而无需使用抓取技术。
推荐阅读
- android - 将项目数据传递给活动
- scala - 为什么在我向类型引入参数后它会停止工作?(斯卡拉)
- laravel - 是否可以将多个值传递给 Laravel 控制器
- c# - 为什么带有返回左外连接结果的存储过程的 EF Core FromSql 重复数据记录
- android - 我什么时候应该使用对象类型与直接 Kotlin 文件
- java - 无法获取 Java 代码以将用户输入的数据分配给 Joptionpane 中的对象字段
- c++ - C++ 中的类型双关语问题
- pyspark - 从 pyspark 中的所有列名中删除空格
- java - Java 11:导入 javax.xml.ws.WebFault:“无法解析符号 ws”
- angular - (Angular)使用双向数据绑定与服务在组件之间共享数据