Some interesting Python snippets
A few interesting Python snippets I came accross on programming.reddit.com:
python -m SimpleHTTPServer
Starts an HTTP server on port 8000 that will serve the files in the current directory. Very useful for quickly transferring a file from one computer to another when you don’t have a SSH or FTP server running.
python -m smtpd -n -c DebuggingServer localhost:1025
Will start an SMTP server on 1025 and print the emails it receives to stdout, great for testing.
import urllib
urllib.urlretrieve('http://localhost:8000/...')
Retrieves a file over HTTP
python -i myScript.py
If there’s an exception it allows you to work from the console.