optparse

Important

I think argparse is the module to use for python 3

Sample

def main():
    from optparse import OptionParser
    usage = "usage: %prog [options] FILENAME"
    description = """Split a test file into chunks."""
    parser = OptionParser(usage)
    parser.description = description
    parser.add_option("-v", "--verbose",
        action="store_true",
        default=True)
    parser.add_option("-c", "--count",
        type="long",
        help="Split file every COUNT number of lines.")
    # Set defaults.
    parser.set_defaults(count=1000000)
    (options, args) = parser.parse_args()
    if not options.count:
        parser.print_help()
        parser.error("The count parameter is missing.")
    if len(args) != 1:
        parser.error("incorrect number of arguments")
    file_name = args[0]
    if options.verbose:
        print 'Split %s every %s lines.' % (file_name, options.count,)
    file_splitter = FileSplitterLineCount()
    file_splitter.do_work()

if __name__ == "__main__":
    main()