I want to pass a list of arrays (or a 2D array) such as [[1,2,3],[4,5,6]]
from C to a Python script which computes and returns a list. What possible changes would be required to the embedding code in order to achieve this? The python script to be executed is as follows:
abc.py
import math
def xyz(size,wss):
result=[0 for i in range(size)]
for i in range(size):
wss_mag=math.sqrt(wss[i][0]*wss[i][0]+wss[i][1]*wss[i][1]+wss[i][2]*wss[i][2])
result[i]=1/wss_mag
return result
Here size is the number of 1D arrays in WSS (for e.g. 2 in case wss=[[1,2,3],[4,5,6]]
) The question is different than the suggested duplicate in the sense it has to return back a list as a 1-D array to C.