optparse question (python 2.6)

Andy Kannberg andy.kannberg at gmail.com
Mon Aug 26 12:16:58 EDT 2013


Hi python-guru's,

I am new to Python, coming from a long history of Unix/linux shell
programming.
I am creating a Python script (In Python 2.6)  which should be able to read
command line options and arguments.
So far, I figured out how to do that with optparse. I can add options (and
arguments ) .
There are about 7 options that can be selected.

However, I can't seem to figure out how to force that only one option is
allowed when the script is invoked. In other words: How to restrict the
script to accept only one of the available options ?

cheers,
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130826/2ae9d674/attachment.html>


More information about the Python-list mailing list