In a LAN , Need to share the contents of a folder .
We can have... On any one python On the computer of the environment , Quickly set up a http Agreed services , Then share the contents of the files in the folder . Yes, just one line of code
Pass the relevant project documents of the computer through http The agreement is shared , Let other users in the LAN adopt IP The address can be accessed and downloaded directly .
IP Address :192.168.0.111 Shared folders :file
Shared code
PS D:\file> python -m http.server 9090
Access the shared address directly in the browser + port , To access shared folders , It can also be downloaded .
Browser open http://192.168.0.111:9090
--bind: The binding of IP and port , The default is native ip, The default port is 8080
PS D:\> python -m http.server -h usage: server.py [-h] [--cgi] [--bind ADDRESS] [port] positional arguments: port Specify alternate port [default: 8000] optional arguments: -h, --help show this help message and exit --cgi Run as CGI Server --bind ADDRESS, -b ADDRESS Specify alternate bind address [default: all interfaces] PS D:\>
In this paper, from https://juejin.cn/post/6973616671412092964, If there is any infringement , Please contact to delete .