Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53009 > unrolled thread

optparse question (python 2.6)

Started byAndy Kannberg <andy.kannberg@gmail.com>
First post2013-08-26 18:16 +0200
Last post2013-08-26 18:16 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  optparse question (python 2.6) Andy Kannberg <andy.kannberg@gmail.com> - 2013-08-26 18:16 +0200

#53009 — optparse question (python 2.6)

FromAndy Kannberg <andy.kannberg@gmail.com>
Date2013-08-26 18:16 +0200
Subjectoptparse question (python 2.6)
Message-ID<mailman.242.1377534246.19984.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web