[Tutor] Silly loop question

mailing list ml.cyresse at gmail.com
Tue Aug 16 12:41:58 CEST 2005

Hi all, 

I should know this, but it seems to elude me at present. 

I have a loop which is looping through a line of chars by index. 

So, one of these -  

for i in range(len(line)):

Now, question is, is there a simple way to 'fast forward'  index i?

At the moment, I'm doing it like this - 

changeIndex = None
al = len(line)
for i in range(al):

         if changeIndex and (i < changeIndex):

        if line[i] == "{":
		nextRightBracket = line.find("}",i)
                #other stuff happens
                changeIndex = nextRightBracket + 1

As I said, pretty dumb question, so somewhat expecting to be told to
read Alan's tutorial again. *grin*


Liam Clarke

More information about the Tutor mailing list