用Python一键搭建Http服务器的方法
作者:墨染百城 时间:2021-08-09 19:36:32
今天好友问我怎么从阿里云服务器上把文件下载下来。我一听之下觉得办法很多啊,随意搭个服务器,然后把文件一丢就可以下载了;弄个FTP也行;直接用远程桌面往下拖也可以。
考虑到便捷性,觉得上面的办法都比较麻烦,最好能有个直接解决问题的办法。然后就找到了Python里面。
Python3请看
python -m http.server 8000
Python2请看
python -m SimpleHTTPServer 8000
总之就是一条Python命令就能在当前目录起一个Http服务器,然后就可以下载文件了。嗯,Python是世界上最好的语言。
效果如图所示:
参考资料
https://docs.python.org/3/library/http.server.html?highlight=http.server#http.server.HTTPServer
https://docs.python.org/2/library/simplehttpserver.html
来源:https://blog.csdn.net/mrbcy/article/details/72630201
标签:搭建,Http,服务器,Python
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
js判断变量是否未定义的代码
2023-08-16 03:43:27
利用python程序生成word和PDF文档的方法
2023-08-26 13:31:44
Python读写JSON文件的操作详解
2021-03-22 11:46:35
![](https://img.aspxhome.com/file/2023/0/82670_0s.jpg)
详解Python如何轻松实现定时执行任务
2022-02-02 16:44:42
![](https://img.aspxhome.com/file/2023/5/88995_0s.png)
解决Keras 与 Tensorflow 版本之间的兼容性问题
2022-08-04 08:18:53
PDO::quote讲解
2023-06-03 21:14:37
把pandas转换int型为str型的方法
2022-02-16 15:45:03
jquery AJAX 三个发送状态 posting, error, success
2010-07-31 18:59:00
解决python Jupyter不能导入外部包问题
2021-02-02 06:19:03
![](https://img.aspxhome.com/file/2023/0/72790_0s.jpg)
python 使用pygame工具包实现贪吃蛇游戏(多彩版)
2021-05-10 17:29:19
![](https://img.aspxhome.com/file/2023/3/105383_0s.jpg)
MySQL中与NULL值有关的疑难问题
2008-11-24 12:47:00
教你使用python做一个“罚点球”小游戏
2022-10-12 00:09:03
python实现美团订单推送到测试环境,提供便利操作示例
2023-03-23 13:39:54
Selenium 安装和简单使用的实现
2023-12-01 07:22:55
![](https://img.aspxhome.com/file/2023/0/112450_0s.png)
Python-Selenium自动化爬虫
2021-04-04 10:55:39
![](https://img.aspxhome.com/file/2023/3/121013_0s.png)
uwsgi+nginx部署Django项目操作示例
2021-05-04 02:23:50
![](https://img.aspxhome.com/file/2023/5/97045_0s.png)
Python中socket网络通信是干嘛的
2023-12-16 02:57:03
Django处理Ajax发送的Get请求代码详解
2023-06-29 08:40:40
![](https://img.aspxhome.com/file/2023/7/78787_0s.png)
Python趣味实例,实现一个简单的抽奖刮刮卡
2023-07-20 18:59:41
![](https://img.aspxhome.com/file/2023/1/71401_0s.jpg)
python实现删除列表中某个元素的3种方法
2023-02-08 16:01:59