Determine actually given command line arguments

Roy Smith roy at panix.com
Wed May 15 08:24:54 EDT 2013


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']



More information about the Python-list mailing list