Here is the mandatory first example:
$ python -c "print( 'hello world')"
%
%
%
\subsection{ Invoking Python}
An interactive session is started by:
\begin{verbatim}
$ python
CTRL-d ends the session. The startup file for the interactive session is specified by the environment variable PYTHONSTARTUP.
Python scripts are invoked by:
$ python fileName.py
If the first line of the script contains the interpreter, it can be invoked by ./fileName.py.
#!/usr/bin/env python
#
# the following lines execute the startup script. They are optional.
#
import os
filename = os.environ.get('PYTHONSTARTUP')
if filename and os.path.isfile(filename):
execfile(filename)
print( "hello world")