Quick Webserver

Source

Create a webserver in the current working directory and server whatever is there on port 8000:

# Python 2
$ python -m SimpleHTTPServer

# Python 3
$ python3 -m http.server

# Twistd
$ twistd -n web -p 8000 --path .

Positional Parameters

Source

import argparse

parser = argparse.ArgumentParser(
    description='Something very smart'
    )
parser.add_argument('--input', '-i',
                    required=True,
                    metavar='<dir>',
                    help='Some helpfull text',
                    action='store_true')
"""
Rince and repeat.
"""

args = parser.parse_args()
print(args.input)

Script header

#!/usr/bin/python3
# -*- coding: utf8 -*-
#