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


Groups > comp.lang.python > #51977

Re: [argparse] mutually exclusive group with 2 sets of options

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rafadurancastaneda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:: [': 0.04; 'syntax': 0.04; 'subject:group': 0.05; 'escribi\xc3\xb3:': 0.16; 'script?': 0.16; 'subject:argparse': 0.16; 'subject:options': 0.16; 'advance.': 0.19; 'subject:] ': 0.20; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'url:python': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; 'module.': 0.36; 'thanks': 0.36; 'possible': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'message-id:@gmail.com': 0.38; 'url:library': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'from:charset:utf-8': 0.61; 'exclusive': 0.81; 'groups:': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=LqdnynoY/LkRSO2KYtMS5rmQn6NFyh4wotsQmDegNr0=; b=PEy8vRV2Ja5ApRHsbu2mnkxZIKT3cvx0ZiN1i1D73/hkTuSnEE5Jy63Fg8Yyc/avuh wEKWRE4RgNGkj2/lPMBtIMMrL8gVuyHDfhxq7loKCrrvwOjHxAYnqVXBEawHjqCe7wHR xzKupnDHhCpc64T0V94UzBWRTDzKQGO+1Fe5tfMCksJRRUfX1KRtBG9G1PcR9uFGZ7f6 80b8aiBxBcynpkNKdNKL2OMW1kHKk+K93sup2KXlA7pgIaBzd0Gj0WOTNA42ZThHyToC kCyPVG0Ho1W88Ht9bvx2P53f2Yw+m6+/wb7o53ucbB05WnrA+QW+1qJKuj8mLNRQ7Oux AEtg==
X-Received by 10.180.98.233 with SMTP id el9mr7776758wib.54.1375732885147; Mon, 05 Aug 2013 13:01:25 -0700 (PDT)
Date Mon, 05 Aug 2013 22:01:22 +0200
From Rafael Durán Castañeda <rafadurancastaneda@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7
MIME-Version 1.0
To python-list@python.org
Subject Re: [argparse] mutually exclusive group with 2 sets of options
References <51fdb81b$0$2423$426a74cc@news.free.fr>
In-Reply-To <51fdb81b$0$2423$426a74cc@news.free.fr>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.217.1375732889.1251.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375732889 news.xs4all.nl 15936 [2001:888:2000:d::a6]:45231
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51977

Show key headers only | View raw


El 04/08/13 04:10, Francois Lafont escribió:
> Hi,
>
> Is it possible with argparse to have this syntax for a script?
>
> my-script (-a -b VALUE-B | -c -d VALUE-D)
>
> I would like to do this with the argparse module.
>
> Thanks in advance.
>
>
I think you are looking for exclusive groups:

http://docs.python.org/2.7/library/argparse.html#argparse.add_mutually_exclusive_group

HTH

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-04 04:10 +0200
  Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-05 04:05 +0200
    Re: [argparse] mutually exclusive group with 2 sets of options Joshua Landau <joshua@landau.ws> - 2013-08-05 04:53 +0100
  Re: [argparse] mutually exclusive group with 2 sets of options Miki Tebeka <miki.tebeka@gmail.com> - 2013-08-05 07:11 -0700
    RE: [argparse] mutually exclusive group with 2 sets of options "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-08-05 17:11 +0000
    Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-06 00:13 +0200
  Re: [argparse] mutually exclusive group with 2 sets of options Rafael Durán Castañeda <rafadurancastaneda@gmail.com> - 2013-08-05 22:01 +0200
    Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-06 00:34 +0200
      Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-07 01:18 +0200
        Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-07 01:36 +0200
  RE: [argparse] mutually exclusive group with 2 sets of options "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-08-05 22:15 +0000

csiph-web