/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
from optparse import OptionParser USAGE = """usage: %prog [options] <file1> <file2> ... """ if __name__ == "__main__": parser = OptionParser(usage=USAGE) parser.add_option("-o", "--output", dest="filename", help="generate output infile", metavar="FILE") parser.add_option("-q", "--quiet", action="store_false", dest="verbose", default=True, help="don't print status messages to stdout") (options, args) = parser.parse_args() if not args: parser.print_help() else: print options.verbose print options.filename print args
Comments
