简体   繁体   中英

How to pass a python list to a C extension function and append some values?

Say I have a python list:

l=[[1,2],[3,4]]

I want to pass it to the following C extension:

PyObject *acc(PyObject *self, PyObject *args)
{
PyObject * l;
PyArg_ParseTuple(args, "O", &l);
//l.append([5,6]
}

I just wonder how to modify the above function to achieve what I want to do in the comment line.

PyList_Append() ,那将是PyList_Append() ......

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM