python v code example

Example 1: python version

python ––version

Example 2: latest version of python

# For macs... 
#  Apparently you don't want to upgrade 2.* just install 3.*

% brew install python3

Example 3: run python with options

import argparse
import sys

parser = argparse.ArgumentParser(description="Does some awesome things.")
parser.add_argument('message', type=str, help="pass a message into the script")

if __name__ == '__main__':
    args = parser.parse_args(sys.argv[1:])
    print args.message