Executing Python - CTXz/Python-Sandbox GitHub Wiki

Interpreter

To start the python 3 interpreter, simply enter python in your terminal. This interpreter can execute real-time python code. The python interpreter can be exited using the exit() function call.

Example:

Python 3.6.0 (default, Jan 16 2017, 12:12:55)
[GCC 6.3.1 20170109] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World") 
Hello World
>>> exit()

Executing scripts

Python scripts usually end with an .py extension. Executing a python file is done by passing its path as an argument to the interpreter.

python[3] [file.py]

Example:

[ctxz@GLaDOS Python-Sandbox]$ python3 HelloWorld.py
Hello world