This is an old revision of the document!
Table of Contents
Python
I find the W3School site to be more helpful initially. Then, if I need more detail and definition, I got to the official Python doc site (which, honestly, I find difficult to navigate).
W3 Schools:
-
-
- List Methods | https://www.w3schools.com/python/python_lists_comprehension.asp | List Comprehensions]]
Python Site: python.org
-
- Built-In Types (& their methods, etc.)
If you do not want to preface all your script names with python3
to run them, your Python scripts should being with (note: your filesystem address may differ):
#!/usr/bin/python3
Web Server
Here's an easy quick Python Web Server in your pwd:
python -m SimpleHTTPServer 8080
Pick a port. 8080 is random. Tab completion works for the module name (-m is for “module”). This allows you to transfer files anywhere on the network.
- Put your files in the subdir
- Spin up the Python web server
- Access that server by IP address: port number (192.168.0.101:8080) from any machine
- Download files from the server machine to the client machine
- Documentation: https://docs.python.org/2/library/simplehttpserver.html
Web Server (Py3)
If you use Python 3, you should instead write
python3 -m http.server 8080
Python3 http.server documentation: https://docs.python.org/release/3.0.1/library/http.server.html
FTP One-Liner
Note: You may have to pip install pyftpdlib
python -m pyftpdlib
- Ordered List ItemConnect to that machine's IP address with the port number shown.
- Download anything. Navigate around.
Check: File Load
Runs main() if file was not imported:
if __name__ == '__main__': main()