-3

Assuming that the length of the list is always even, what is the best way to convert the following list:

points = [[1437.8552278820375, 1187.3458445040214, 1084.396782841823, 1245.6836461126006, 1104.9865951742627, 1430.9919571045577, 1458.4450402144773, 1307.4530831099196]]

to a tuple list such as:

points = [(1437.8552278820375, 1187.3458445040214), (1084.396782841823, 1245.6836461126006), (1104.9865951742627, 1430.9919571045577), (1458.4450402144773, 1307.4530831099196)]
Tim
  • 513
  • 5
  • 20

1 Answers1

1
points = zip(points[0][::2], points[0][1::2])
list(points)
fiphrelin
  • 320
  • 1
  • 9