Python搭建http下载服务器

python 复制代码
import http.server
import socketserver
 
PORT = 8002
 
Handler = http.server.SimpleHTTPRequestHandler
 
with socketserver.TCPServer(("", PORT), Handler) as httpd:
    print("serving at port", PORT)
    httpd.serve_forever()

使用: 保存为httpserver.py, 放在你想访问和下载文件夹下。

python运行httpserver.py.

网页搜索你自己本地ip:端口号,如 http://192.168.1.111:8002

相关推荐
程序猿小D24 分钟前
第二百六十七节 JPA教程 - JPA查询AND条件示例
java·开发语言·前端·数据库·windows·python·jpa
杰哥在此2 小时前
Python知识点:如何使用Multiprocessing进行并行任务管理
linux·开发语言·python·面试·编程
小白学大数据2 小时前
User-Agent在WebMagic爬虫中的重要性
开发语言·爬虫·http
枫叶丹44 小时前
【在Linux世界中追寻伟大的One Piece】进程信号
linux·运维·服务器
zaim14 小时前
计算机的错误计算(一百一十四)
java·c++·python·rust·go·c·多项式
GodK7775 小时前
HTTPS 的加密流程
网络协议·http·https
灯火不休ᝰ5 小时前
[win7] win7系统的下载及在虚拟机中详细安装过程(附有下载文件)
linux·运维·服务器
数云界7 小时前
如何在 DAX 中计算多个周期的移动平均线
java·服务器·前端
PythonFun8 小时前
Python批量下载PPT模块并实现自动解压
开发语言·python·powerpoint
炼丹师小米8 小时前
Ubuntu24.04.1系统下VideoMamba环境配置
python·环境配置·videomamba