#!/usr/bin/python import argparse parser = argparse.ArgumentParser(description="Example of argparse", epilog="This appears at the end") parser.add_argument("filename", metavar="file", help="The file we'll use with this program") parser.add_argument("-a", help="a is a nice option to set", action="store_true") parser.add_argument("-b", help="b is not as nice, because it bites", action="store_true") parser.add_argument("-g", metavar="gorillacount", help="Number of gorillas, default 100", default="100") args = parser.parse_args() print "Args.a" , args.a print "Args.b" , args.b print "Args.g" , args.g print "Args.filename" , args.filename