Hi,
I have a list of tuples like this:
[(1423, 2637),(6457, 8345),(9086, 10100),(12304, 15666)]
Each tuple references coordinates of a big long string and they are in the
'right' order, i.e. earliest coordinate first within each tuple, and
eearliest tuple first in the list. What I want to do is use this list of
coordinates to retrieve the parts of the string *between* each tuple. So in
my example I would want the slices [2367:6457], [8345:9086] and
[10100:12304]. Hope this is clear.
I'm coming up short of ideas of how to achieve this. I guess a for loop,
but I'm not sure how I can index *the next item* in the list, if that makes
sense, or perhaps there is another way.
Any help, as ever, appreciated.
Chris
Not sure if I follow you, seems like computational biology or something to me, but my quick (and dirty) solution:
l = [(1423, 2637),(6457, 8345),(9086, 10100),(12304, 15666)]
for x in range(len(l)-1):
l[x][1], l[x+1][0]
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
