I need to extract coordinate values out of this list in the below manner.
input: [[2, 0, 4, 6], [3, 0, 4, 6]]
output: [[(2, 4), (0, 6)] , [(3, 4), (0, 6)]]
so far I tried this code:
pathlist = [[2, 0, 4, 6], [3, 0, 4, 6], [1, 0, 4, 6], [2, 0, 4, 6]]
j = 0
k = 2
paths = []
for i in pathlist:
for x in range(len(pathlist)-2):
paths.append((i[j],i[k]))
j += 1
k += 1
But this keeps throwing an index error that I can't quite figure out and I'm not sure if the code is on the right track. in python 3.6