PyTricks #4 - Python HTTP Server
To create a simple Python HTTP Server simply navigate to the desired folder and type the following in command prompt: python -m http.server 8000
This command will create an HTTP Server hosted on port 8000.
#pytricks#python#JD
Did you know. Python has a server built into the std library. Comes in handy while previewing websites and serving files.
3.x $ python3 -m http.server
2.x $ python2 -m SimpleHTTPServer 8000
Serves current directories at http://0.0.0.0:8000#python#pytricks#Krafty
PyTricks #5 - For Else
The else block is executed when the loop completes normally i.e. the loop is NOT terminated by a break statement
#pytricks#python#JD
If the condition evaluates to True, then the program executes as normal.
But if the condition evaluates to False, then the program will raise an AssertionError along with an optional message.
#pytricks#python#JD
You can use this server to share files between the devices on the LAN.
First, find the local IP address of the device on which the server is hosted using the command ipconfig (For Windows) or ifconfig (For Linux).
#pytricks#python#JD