On 21 Jul 2005 20:39:36 +0100, <b class="gmail_sendername"><a href="mailto:cgw501@york.ac.uk">cgw501@york.ac.uk</a></b> <<a href="mailto:cgw501@york.ac.uk">cgw501@york.ac.uk</a>> wrote:<div><span class="gmail_quote">
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br><br>I have a list of tuples like this:<br><br>[(1423, 2637),(6457, 8345),(9086, 10100),(12304, 15666)]
<br><br>Each tuple references coordinates of a big long string and they are in the<br>'right' order, i.e. earliest coordinate first within each tuple, and<br>eearliest tuple first in the list. What I want to do is use this list of
<br>coordinates to retrieve the parts of the string *between* each tuple. So in<br>my example I would want the slices [2367:6457], [8345:9086] and<br>[10100:12304]. Hope this is clear.<br><br>I'm coming up short of ideas of how to achieve this. I guess a for loop,
<br>but I'm not sure how I can index *the next item* in the list, if that makes<br>sense, or perhaps there is another way.<br><br>Any help, as ever, appreciated.<br><br>Chris<br><br>
Not sure if I follow you, seems like computational biology or something to me, but my quick (and dirty) solution:<br>
</blockquote><div><br>
l = [(1423, 2637),(6457, 8345),(9086, 10100),(12304, 15666)]</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
for x in range(len(l)-1):<br>
l[x][1], l[x+1][0]</blockquote></div><br>