Breaking the loop in Jython

Posted by kdev on Stack Overflow See other posts from Stack Overflow or by kdev
Published on 2010-03-27T05:02:10Z Indexed on 2010/03/27 5:23 UTC
Read the original article Hit count: 248

Filed under:

Hi everyone,

I have a written a loop for and if condition and I want to break to loop completely when if gets satisfied.

while count:
    i=0
    for line in read_record:
        #print str.strip(count[1:28])
        #print str.strip(read_record[i])
        if string.find(str.strip(read_record[i]),str.strip(count[1:28]))>0:
            code=str.strip(read_record[i+19])+str.strip(read_record[i+20])
            print code[25:]
            break

        i=i+1

So here if the if string.find condition gets satisfied I want to go to while loop flow. Please tell me what will be the best place to break and how should I modify the program so that once the if condition is satisfied I am out of the loop and start again with while loop.

© Stack Overflow or respective owner

Related posts about jython