User Tools

Site Tools


About Python

This section is for python beginners.


If you are new to python you should know it’s very important to keep indentation to make a python script work properly.

Please make sure it’s correctly kept when you copy the contents of my script to your file.


If you don't know what python version you have installed you can type 'python' at your console and see what it says. It should be something like this:

Python 2.7.3 (default, Apr 24 2012, 00:06:13) 
[GCC 4.7.0 20120414 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Then use Ctrl+d to exit the python console. So, the second line of that output shows you the version. If it says 3 or over you may have to try the command 'python2' instead, or may need to install it too.


The sheebang is the first line of the script.

It tells the operating system what interpreter to use to run the code.

Specifically it also determines the version of the Python it will use, depending on how you have installed python on your pc.

More or less sheebangs have the form #!/bin/bash/<interpreter> then the file /bin/bash/<interpreter> should exist in your system and it will define the version that will run.

So change your sheebang according to how you have installed python in your system and the version needed for each script. Running /bin/bash/<interpreter> in your console should tell you the version it would use (see Version)

If a 'script' has no sheebang, it may be a library used by other scripts. In that case the script won't run anything by itself and can only be imported by others to use it's functions.

user/katia/about_python.txt · Last modified: 2012/09/30 09:53 (external edit)