利用Python实现在同一网络中的本地文件共享方法
作者:zero_4869 时间:2023-10-31 00:41:58
本文利用Python3启动简单的HTTP服务器,以实现在同一网络中共享本地文件。
启动HTTP服务器
打开终端,转入目标文件所在文件夹,键入以下命令:
$ cd /Users/zero/Documents/localFiles
# python -m http.server <port number>
$ sudo python3 -m http.server 8092
Serving HTTP on 0.0.0.0 port 8092 (http://0.0.0.0:8092/) ...
生成共享链接
打开浏览器并输入URL:http://localhost:8092,可在本地查看该文件。然后在终端键入ifconfig查看本机IP地址,如192.168.199.154,用其替换localhost则生成链接http://192.168.199.154:8092/。
分享本地文件
与同一网络的任何人分享此链接,可实现本地文件共享。
来源:https://blog.csdn.net/weixin_37325825/article/details/74362730
标签:Python,网络,文件,共享
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python 双循环遍历list 变量判断代码
2021-02-10 12:38:12
MySQL安装配置以及安装失败解决过程
2024-01-13 18:55:28
![](https://img.aspxhome.com/file/2023/1/124891_0s.png)
js倒记时代码,自定义时间改变时间,日期到时事件,日期格式。
2010-08-08 08:51:00
JavaScript中神奇的call()方法
2024-04-30 09:52:41
python机器学习理论与实战(六)支持向量机
2023-10-18 22:59:53
![](https://img.aspxhome.com/file/2023/8/75168_0s.jpg)
Spring数据库连接池实现原理深入刨析
2024-01-12 17:16:53
![](https://img.aspxhome.com/file/2023/4/71234_0s.png)
python3.3使用tkinter开发猜数字游戏示例
2023-09-05 06:53:02
Django1.11自带分页器paginator的使用方法
2021-07-04 12:44:23
js计算精度问题小结
2024-04-10 13:55:24
手把手教你用python抢票回家过年(代码简单)
2023-07-13 22:46:02
![](https://img.aspxhome.com/file/2023/0/118100_0s.jpg)
python3 中使用urllib问题以及urllib详解
2022-01-09 05:59:16
Python Pandas数据合并pd.merge用法详解
2022-07-18 22:15:47
![](https://img.aspxhome.com/file/2023/5/93495_0s.png)
DJANGO-ALLAUTH社交用户系统的安装配置
2022-10-03 11:29:08
Git 教程之服务器搭建详解
2022-07-28 06:44:20
python自动化测试selenium操作下拉列表实现
2023-09-06 00:26:50
![](https://img.aspxhome.com/file/2023/4/110394_0s.png)
Python读取postgresql数据库详情
2024-01-29 13:01:17
![](https://img.aspxhome.com/file/2023/2/131752_0s.png)
从SQL Server2000升级到2005的过程解析
2009-01-13 14:07:00
python openvc 裁剪、剪切图片 提取图片的行和列
2022-07-03 15:29:40
![](https://img.aspxhome.com/file/2023/4/77874_0s.jpg)
PowerDesigner中如何导入SQL Server数据库
2024-01-17 08:38:46
![](https://img.aspxhome.com/file/2023/5/102075_0s.jpg)
JS分割字符串并放入数组的函数
2023-08-05 15:31:03