How can I use a PyObject in C++?

L

lixinyi.23

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top