Determine actually given command line arguments

Dave Angel davea at davea.name
Wed May 15 08:51:30 EDT 2013


On 05/15/2013 08:24 AM, Roy Smith wrote:
> In article <kmva9j$1hbk$1 at gwdu112.gwdg.de>,
>   Henry Leyh <henry.leyh at 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



More information about the Python-list mailing list