Sometimes we’d like to copy some file from our computer to our mobile phone and other devices at home. However, common chat applications have set a limit of max upload size or has limited the upload and download speed. Then Python has a place.
First we need to install Python 3.x, if using Linux please refer to [Build Python Environment in Linux]. If using Windows, you can download from official straightly: https://www.python.org/downloads/windows/, The .zip file is portable version, other versions need installation.
（Windows Users）Go to the folder to share, right click with
Open Powershell in this folder or
Open command line in this folder.
python3 -m http.server （
python3 might be replaced by
py）, it uses port 8000 for default.
In order to use a specific port, type
python3 -m http.server <PORT>. To designate the folder, type
python3 -m http.server -d <FOLDER NAME>.
There is some more things to do with Portable version, you have to type the full path of Python executable program instead of the abbreviations like
To make a .py script, create a new file and type content below,
PORT = 8000 # Port
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)