1

That is my sample code that works fine, but i'm asking my is there a "better" way to manipulate the loop to get the same result. The value of (old,value) are coordinates to draw a line from point 1 to point 2 ...from point 2 to point 3 and so on.

old = []
for index, value in enumerate(data):
    if N.size(old)>0:
        print old,value
    old = value
user320212
  • 11
  • 1

1 Answers1

1

try this

>>> a = [1, 2, 3, 4]
>>> zip(a[:-1], a[1:])
[(1, 2), (2, 3), (3, 4)]
Nilesh
  • 20,521
  • 16
  • 92
  • 148