Pass A Var To a Python Script?

rishi pathak mailmaverick666 at gmail.com
Wed Apr 11 07:17:30 EDT 2007


Hi,
Use sys.argv to access the command line arguments
eg:
import sys
print sys.argv[0]
print sys.argv[1]

Run the above script as
/test.py hello world

On 4/7/07, Eric Price <soyouthinkimgonnalikethis at hotmail.com> wrote:
>
> Hi;
> How do I pass a variable to a python script? Something like this (which
> doesn't work):
>
> ./test.py?var=hello_world
>
> TIA,
> Eric
>
> _________________________________________________________________
> Mortgage refinance is Hot. *Terms. Get a 5.375%* fix rate. Check savings
>
> https://www2.nextag.com/goto.jsp?product=100000035&url=%2fst.jsp&tm=y&search=mortgage_text_links_88_h2bbb&disc=y&vers=925&s=4056&p=5117
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Regards--
Rishi Pathak
National PARAM Supercomputing Facility
Center for Development of Advanced Computing(C-DAC)
Pune University Campus,Ganesh Khind Road
Pune-Maharastra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070411/70e7dba6/attachment.html>


More information about the Python-list mailing list