无法从Ishares网站下载CSV文件
通过使用下面的代码(链接检查,是正确的),如果我使用像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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是您对拼写并不谨慎。您有
文件名
,filetype
和datatype
,而网站需要文件名
,filetype
和datatype
。资本化必须匹配。THe problem is you have not been careful about the spelling. You have
filename
,filetype
anddatatype
, whereas the site requiresfileName
,fileType
, anddataType
. The capitalization must match.