[Tutor] Python

Michael Lange klappnase at freenet.de
Fri Jan 16 17:01:11 EST 2004


On Tue, 13 Jan 2004 13:08:46 +0200
Anthony Tshwane <kgomotso at kgatelopele.co.za> wrote:

> Greetings.
> 
> I am new in the python programming language and I presently trying to run 
> examples that you have give.I would like to know how are those steps executed 
> in linux invironment since IO am using linux Mandrake.i folloed that but I 
> started encountering the problam when I have to run the script.May you just 
> send me some notes about how to run that in linux.
> 
> With thanks
> Kgomotso
> 

If you want to run a python script on linux save the code to a file and make the file executable:

[pingu at localhost pingu]$  chmod -v 755 path-to-your-file

then you can run the program from a shell with:

[pingu at localhost pingu]$  python path-to-your-file

You can avoid the need to call the python interpreter each time if you put at the first line of your
file:

    #!/usr/bin/env python

If the shell finds this at the first line of your file it will automatically start the python
interpreter, so you can start your script like any other program with

[pingu at localhost pingu]$  path-to-your-file


I hope this helps

Michael



More information about the Tutor mailing list