基本上,我想要做的是使用封装在Py_buffer中的memoryview-object向Python公开一个C数组。*buf->buf++); //this prints the values i set in the Python function// pack the memoryview into an argument list and call the <em
我们的Python2代码(适用于py2): from cStringIO import StringIO
rows = [[col.encode('latin-1') for col in row] for row in rows] writer = csv.writer(buf) return buf.getvalue() 一