python newbie question

Christoph Haas email at christoph-haas.de
Sun Feb 26 16:55:57 EST 2006


On Sunday 26 February 2006 22:44, ken.carlino at gmail.com wrote:
> I am new to python, can you please tell me how can I convert my python
> script into an executable on linux?
> i.e. instead of typing 'python myscript.py abc', I just need to do
> 'myscript.py abc'?

Use the shebang syntax. Use this as a first line in your script:

#!/usr/bin/python

Some people rather prefer an "env" approach.

Remember to make your script executable (chmod +x scriptname).

> and how can I get the input argument from my script , in my example,
> how can I read 'abc'?

import sys
print sys.argv[1]

Kindly
 Christoph
-- 
~
~
".signature" [Modified] 1 line --100%--                1,48         All



More information about the Python-list mailing list