First page Back Continue Last page Overview Graphics

Using the Interpreter as a Shell

#include <python2.6/Python.h>

main(int argc, char** argv ) {

printf("embed-simple\n");

Py_Initialize();

Py_Main(argc, argv);

}

Calling the program:

$ ./a.out

embed-simple

Python 2.6.4 (r264:75706, Nov 2 2009, 14:54:49)

[GCC 4.4.1] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>