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


Groups > comp.lang.python > #45338

Re: Determine actually given command line arguments

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.039
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'sys': 0.07; 'arguments': 0.09; 'namespace': 0.09; 'subject:command': 0.09; 'python': 0.11; "'bar']": 0.16; 'henry': 0.16; 'roy': 0.16; 'wrote:': 0.18; 'command': 0.22; 'import': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'there': 0.35; 'i.e.': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'mentioned': 0.61; 'simple': 0.61; "you're": 0.61; 'determine': 0.67; 'received:74.208': 0.68; 'smith': 0.68; 'article': 0.77; 'received:74.208.4.194': 0.84
Date Wed, 15 May 2013 08:51:30 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5
MIME-Version 1.0
To python-list@python.org
Subject Re: Determine actually given command line arguments
References <kmva9j$1hbk$1@gwdu112.gwdg.de> <roy-C8F8F4.08245415052013@news.panix.com>
In-Reply-To <roy-C8F8F4.08245415052013@news.panix.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:J8zyt5zdtUd1+nzPy6TAOxn1rjSklnT0fEW8AofhA88 ktVH0iTCLpmREkQ4gg+UuVN6BvkebGUO5BBSBwu5VLojfEIUlI r/fQ6Dj/fWavh2tzdm1FkQW+ne+OEodEhHKgv7GM5utqCwuuBa akSNjU+Jnx33s3IQH8BJd7Jet81PBePsfgULMHSMS/2SYCz3Dc KfyLf4RUUqh0rHil5LgSvwszkwtHp50w+M5e5j1a5GRoIyxnZg iTNEchqaj+Wp3SGtmIpgSmAwddbLnrebpouxlpdpcLATvKVy+2 2dY/J2snqtHFpV09zA9pX5BqKlYLROeoun+RhKHEDX2MaBDDQ= =
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.1696.1368622312.3114.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368622312 news.xs4all.nl 15979 [2001:888:2000:d::a6]:51920
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45338

Show key headers only | View raw


On 05/15/2013 08:24 AM, Roy Smith wrote:
> In article <kmva9j$1hbk$1@gwdu112.gwdg.de>,
>   Henry Leyh <henry.leyh@ipp.mpg.de> wrote:
>
>> Is there a simple way to determine which
>> command line arguments were actually given on the commandline, i.e. does
>> argparse.ArgumentParser() know which of its namespace members were
>> actually hit during parse_args().
>
> I think what you're looking for is sys.argv:
>
> $ cat argv.py
> import sys
> print sys.argv
>
> $ python argv.py foo bar
> ['argv.py', 'foo', 'bar']
>

Colin & Roy:
The OP mentioned sys.argv in his original query.

-- 
DaveA

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


Thread

Determine actually given command line arguments Henry Leyh <henry.leyh@ipp.mpg.de> - 2013-05-15 08:34 +0200
  Re: Determine actually given command line arguments "Colin J. Williams" <cjw@ncf.ca> - 2013-05-15 08:03 -0400
    Re: Determine actually given command line arguments Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-05-15 15:51 +0300
  Re: Determine actually given command line arguments Roy Smith <roy@panix.com> - 2013-05-15 08:24 -0400
    Re: Determine actually given command line arguments Dave Angel <davea@davea.name> - 2013-05-15 08:51 -0400
    Re: Determine actually given command line arguments Henry Leyh <henry.leyh@ipp.mpg.de> - 2013-05-15 14:52 +0200
      Re: Determine actually given command line arguments Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-05-15 14:00 +0100
        Re: Determine actually given command line arguments Henry Leyh <henry.leyh@ipp.mpg.de> - 2013-05-15 15:50 +0200
          Re: Determine actually given command line arguments Skip Montanaro <skip@pobox.com> - 2013-05-15 09:08 -0500
            Re: Determine actually given command line arguments Henry Leyh <henry.leyh@ipp.mpg.de> - 2013-05-15 16:39 +0200
              Re: Determine actually given command line arguments Skip Montanaro <skip@pobox.com> - 2013-05-15 09:51 -0500
          Re: Determine actually given command line arguments Wayne Werner <wayne@waynewerner.com> - 2013-05-15 09:16 -0500
      Re: Determine actually given command line arguments roy@panix.com (Roy Smith) - 2013-05-15 11:29 -0400
        Re: Determine actually given command line arguments Henry Leyh <henry.leyh@ipp.mpg.de> - 2013-05-16 07:43 +0200
          Re: Determine actually given command line arguments Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-05-16 09:08 +0300
            Re: Determine actually given command line arguments Henry Leyh <henry.leyh@ipp.mpg.de> - 2013-05-16 09:29 +0200

csiph-web