script.pyis simply printing the Python version used, but with shebang version specified.
So, the results are following.
1. Starting the script from command linepython test.py will give us the default version
Starting the script from command line with specified the version
python3.1 test.pywill give us the 3.1 python version.
3. If we remove the shebang line, so the script will behave absolutely the same, but
./test.pywill fail, when launching with shebang line
./test.py- it will give us the correct 3.1 version. Launching without shebang line this way
python3.1 test.pyalso will give us the 3.0 version.