How do I use python object in C++

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


for example I have the following code:

#include <Python.h>

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

What I would like to know is how can I get the variables I want
after Py_Main(argc,argv)

say I have a=[1,2,'Hello World',0.1234] in the python space,
I would like to have it as a struct in C++.

Any sample code?
Thanks in advance!



More information about the Python-list mailing list