This is the file helloworld.py
#!/usr/bin/env python print "Hello World"to execute this file
$python helloworld.pyTwo elements of the helloworld.py script. First, the command print, this command write to the standard output the parameters given. These parameters can be variables, objects (as we are going to discuss in a later post), or as in this case constants. The second element is the first line starting with the charcarter '#'. In Python every character in a line after the symbol '#' is considered as a comment (python interpreter will ignore this). Particularly in our example we have the following comment
#!/usr/bin/env pythonThis comment is not mandatory, however, it is used if we want to run helloworld.py as an standalone executable. First, we can give execution rights to the file helloworld.py using chmod
$chmod +x helloworld.pyFrom now on, we only have to type,
$./helloworld.pyto execute the helloworld.py.