Im new at python and I just want to know if (and how) it is possible
to send parameters to a program.

what I mean is that when we start python I can call a file that should
be run like this: python myfile.py
can I send additional parameters along with it?  like::: python
myfile.py myVar1 myVar2

You're looking for sys.argv:

 t...@rubbish:~$ python - one two
 Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.argv
 ['-', 'one', 'two']


-tkc



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to