Validating Command Line Options

bruce bushby bruce.bushby at gmail.com
Wed Mar 23 10:35:18 EDT 2011


optparse?

http://docs.python.org/library/optparse.html

if options.a and options.b:
    parser.error("options -a and -b are mutually exclusive")



On Wed, Mar 23, 2011 at 2:10 PM, T <misceverything at gmail.com> wrote:

> For a Python script with multiple command line options, what is the
> best way to go about validating that only certain options are used
> together?  For example, say -s, -t, and -v are all valid options, but
> should never be used together (i.e. -s -t would be invalid).  Thanks
> in advance.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110323/a2525309/attachment-0001.html>


More information about the Python-list mailing list