PyArg_Parse for multiple returns of python on c++

Question:

I am calling python from c++ using PyObject_CallObject

as the python return only a floating point number, i can get it by:

float output_of_python;
   PyObject *pValue,*pArgs;
  pValue = PyObject_CallObject(pFunc, pArgs);
 PyArg_Parse(pValue, "f", &output_of_python);

however, if python’s returns 2 (return first,second), which format of PyArg_Parse(pValue… should i use to assign them to 2 c++ float variables?

p/s: this one does not work: PyArg_Parse(pValue, "f,f", &output_of_python1,&output_of_python2);

Asked By: abcd

||

Answers:

i found it, post it here for anyone needs:

In c++, in order to get 2 variables from return of python, it is

float va1,va2;
PyArg_ParseTuple(pValue, "ff", &va1,&va2);
Answered By: abcd
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.