将excel中的excel文件从网络保存为excel文件 [英] saving an excel file from the web in python as excel file

查看:120
本文介绍了将excel中的excel文件从网络保存为excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下链接。如何将其保存到python中的excel文件中

I have the following link. how can save it to excel file in python

link="http://www.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?deven=0"

我尝试下载:

import requests
dls = "http://www.tsetmc.com/tsev2/excel/MarketWatchPlus.aspx?deven=0"
resp = requests.get(dls)

output = open('test.xls', 'wb')
output.write(resp.content)
output.close()

,但是保存test.xls有以下错误:

but the saving test.xls has the following error:

Error! C:\Users\Relief International\test.xls is not UTF-8 encoded
Saving disabled.
See Console for more details.

我如何使python将上述链接下载为excel文件?

how do I make python download the mentioned link as an excel file?

推荐答案

代码对我来说很好。

错误来自Jupyter,后者不知道如何显示数据。但是应该正确下载文件。

The error comes from Jupyter, which doesn't know how to display the data. But the file should be correctly downloaded.

这篇关于将excel中的excel文件从网络保存为excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆