I am a newbie in Python and C and I would like to know how to put dictionary elements into a C like structure (struct).
For example, here is my structure:
typedef struct
{
int dim;
float *Tab1;
float *Tab2;
}
Tableaux;
Here is my dictionary in Python:
Tableaux = {}
Tableaux["dim"]=None
Tableaux["Tab1"]=[]
Tableaux["Tab2"]=[]
Here is my interface function:
static PyObject* py_initTab(PyObject* self, PyObject* args)
{
PyObject* dict;
Tableaux Tab;
if (!PyArg_ParseTuple(args, "O!", &dict))
return NULL;
Tab.Tab1=dict["Tab1"]; // How could I do something like that?
return Py_BuildValue("");
}