How can I use a PyObject in C++?

lixinyi.23 at gmail.com lixinyi.23 at gmail.com
Wed Sep 24 02:27:45 CEST 2008


for example:
#include <Python.h>

void exec_python_code(int arg, char** argv)
{
    Py_Initialize();
    Py_Main(argc,argv);
    Py_Finalize();
}

What I would like to know is:
after  Py_Main(argc,argv);

How do I get every variable in python space,
say a=[1,2,3,'Hello World',[2,3]]
b=['xx','xxx','ffff',0.1234] , and use them in C++?

any sample code?
Thanks in advance!



More information about the Python-list mailing list