一条python语句搭建http服务器,实现局域网数据下载

一、Python 2.x

当前目录有文件:
http.txt

命令:
python -m SimpleHTTPServer 8888

Serving HTTP on 0.0.0.0 port 8888 …
默认占用 8000 端口。

二、Python 3.x

当前目录有文件:
http.txt

命令:
python -m http.server 8888

Serving HTTP on 0.0.0.0 port 8888 …
默认占用 8000 端口。

三、局域网下载文件

通过curl命令下载到本地
curl -o http.txt http://x.x.x.x:8888/http.txt

你可能感兴趣的:(Python,服务器,网络,运维)