First page Back Continue Last page Overview Graphics

Small Example

Program binding the Python interpreter:

#include <python2.6/Python.h>

main( ) {

Py_Initialize( );

PyRun_SimpleString("a = 2 * 3");

PyRun_SimpleString("print a");

}

Compiling and linking:

gcc -lpython2.6 -lm -L/usr/lib/python2.6/config minimum.c