[Tutor] How to pass command line variables to this python code...

Christian Witts cwitts at compuscan.co.za
Wed Jul 15 08:25:11 CEST 2009

vince spicer wrote:
> First off, selenium is a great tool and the python driver is very powerful
> there are numerous ways to access cli variables,
> the quickest
> import sys
> print sys.srgv
> sys.argv will it output a array of all command line args
> ./selenium-google-test.py yankees
> will out put:
> ['selenium-google-test.py', 'yankees']
> so
> args = sys.argv
> args[0] == 'yankees'
> True
That would be false, the first argument (list index zero) is the script 
name.  You would need to do
args = sys.argv[1:]
if you want to dump the filename from the list.

Kind Regards,
Christian Witts

More information about the Tutor mailing list