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

vince spicer vinces1979 at gmail.com
Wed Jul 15 16:19:19 CEST 2009


good catch, my mistake

args[1] == 'yankees'
True


On Wed, Jul 15, 2009 at 12:25 AM, Christian Witts <cwitts at compuscan.co.za>wrote:

> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090715/1785849b/attachment.htm>


More information about the Tutor mailing list