美文网首页
Python自带HTTP服务实现文件共享

Python自带HTTP服务实现文件共享

作者: 木语沉心 | 来源:发表于2019-10-11 10:41 被阅读0次

python自带服务器的使用方法

    1. 进入待分享的目录
    1. 执行命令

python 2

python -m SimpleHTTPServer 端口号
默认端口号是8000

>>> C:\Users\Administrator>python2 -m SimpleHTTPServer
    Serving HTTP on 0.0.0.0 port 8000 ...
    127.0.0.1 - - [11/Oct/2019 10:29:30] "GET / HTTP/1.1" 200 -

python 3

python -m http.server 端口号
默认端口号是8000

>>> C:\Users\Administrator>python3 -m http.server
    Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
    127.0.0.1 - - [11/Oct/2019 10:35:33] "GET / HTTP/1.1" 200 -
    1. 打开浏览器访问该主机的地址

http://自己电脑ip_address:端口号/
不知道 ip 的自行百度
注意:被访问和访问的机器必须在同一个网段中,或者说网络环境相同

访问效果:
image.png

相关文章

网友评论

      本文标题:Python自带HTTP服务实现文件共享

      本文链接:https://www.haomeiwen.com/subject/vlhtmctx.html