无法从Ishares网站下载CSV文件

发布于 2025-01-28 07:37:53 字数 318 浏览 2 评论 0原文

通过使用下面的代码(链接检查,是正确的),如果我使用像Chrome这样的浏览器,我将获得HTML文件,而不是.csv。

import urllib.request
urllib.request.urlretrieve('https://www.ishares.com/us/products/239726/ishares-core-sp-500-etf/1467271812596.ajax?filetype=csv&filename=ivv_holdings&datatype=fund', "file.csv")

这是一个很好的解决方案?

all by using the code below (link checked, it is correct) I get an HTML file as a result instead of .csv if I were to use a browser like Chrome.

import urllib.request
urllib.request.urlretrieve('https://www.ishares.com/us/products/239726/ishares-core-sp-500-etf/1467271812596.ajax?filetype=csv&filename=ivv_holdings&datatype=fund', "file.csv")

What would be a good solution to this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜妞爱困 2025-02-04 07:37:53

问题是您对拼写并不谨慎。您有文件名filetypedatatype,而网站需要文件名filetypedatatype。资本化必须匹配。

THe problem is you have not been careful about the spelling. You have filename, filetype and datatype, whereas the site requires fileName, fileType, and dataType. The capitalization must match.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文