python getopt functionality

Michael ms at cerenity.org
Mon Oct 3 14:33:16 EDT 2005


M.N.A.Smadi wrote:

> I have a perl script that I need to port to python. The script takes
> input from the command line.  Is there a standard way of processing
> command line arguments based on the -flag preceeding the argument?

Yes.

# pydoc getopt
Help on module getopt:

NAME
    getopt - Parser for command line options.

FILE
    /usr/lib/python2.4/getopt.py

MODULE DOCS
    http://www.python.org/doc/current/lib/module-getopt.html
[ ... snip ... ]


Michael



More information about the Python-list mailing list