May-28-2019, 12:24 PM
Hey,
i am using python 3 and new to python.
i have this list :
and i made sure its of type list. and the numbers represent X and Y on a map.
now i need to split \ make this list like an array to fit this logic :
but because its a list i get poly[0] as one big string and havent find a way to split it.
i tryied to use :
and i get this error
p1x,p1y = poly[0]
ValueError: too many values to unpack (expected 2)
please help me split this list.
thanks!
i am using python 3 and new to python.
i have this list :
([[[32.098659, 34.826334], [32.099361, 34.830506], [32.097026, 34.831574], [32.095502, 34.827881]]],)This is how i see the value of the var poly using print
and i made sure its of type list. and the numbers represent X and Y on a map.
now i need to split \ make this list like an array to fit this logic :
p1x,p1y = poly[0] for i in range(n+1): p2x,p2y = poly[i % n] if y > min(p1y,p2y): if y <= max(p1y,p2y): if x <= max(p1x,p2x): if p1y != p2y: xinters = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x if p1x == p2x or x <= xinters: inside = not inside p1x,p1y = p2x,p2y return insidei need somhow to split poly to fit like an array with poly[0] so it can fit this function
but because its a list i get poly[0] as one big string and havent find a way to split it.
i tryied to use :
dataset_list = ''.join(str(poly)) poly = dataset_list.split(']')it didnt work.
and i get this error
p1x,p1y = poly[0]
ValueError: too many values to unpack (expected 2)
please help me split this list.
thanks!