Search This Blog

Wednesday, April 7, 2010

Break the nested(double) loop in python

Programmer Question

I use the following method to break the double loop in Python.




for word1 in buf1:
find = False
for word2 in buf2:
...
if res == res1:
print "BINGO " + word1 + ":" + word2
find = True
if find:
break


Is there better way to break the double loop?



Find the answer here

No comments:

Post a Comment

Related Posts with Thumbnails