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

相关推荐
失败尽常态52344 分钟前
用Python实现Excel数据同步到飞书文档
python·excel·飞书
落笔画忧愁e44 分钟前
FastGPT快速将消息发送至飞书
服务器·数据库·飞书
2501_904447741 小时前
OPPO发布新型折叠屏手机 起售价8999
python·智能手机·django·virtualenv·pygame
青龙小码农1 小时前
yum报错:bash: /usr/bin/yum: /usr/bin/python: 坏的解释器:没有那个文件或目录
开发语言·python·bash·liunx
小冷爱学习!1 小时前
华为动态路由-OSPF-完全末梢区域
服务器·网络·华为
大数据追光猿1 小时前
Python应用算法之贪心算法理解和实践
大数据·开发语言·人工智能·python·深度学习·算法·贪心算法
Leuanghing1 小时前
【Leetcode】11. 盛最多水的容器
python·算法·leetcode
落幕2 小时前
C语言-进程
linux·运维·服务器
xinxiyinhe2 小时前
如何设置Cursor中.cursorrules文件
人工智能·python
诸神缄默不语3 小时前
如何用Python 3自动打开exe程序
python·os·subprocess·python 3