当前位置: 首页 > 后端技术 > Python

Python:将ndarray数据传递给C++

时间:2023-03-26 12:53:48 Python

Pythonnumpy库的ndarray数据结构使用起来非常方便。这里记录一下如何传递给C/C++代码,直接回答:使用的库:ctypesC++代码部分(toPython.cpp):#includeextern"C"voidshowNdarray(int*data,introws,intcols){for(inti=0;i