title: Python, next iteration of the loop over a loop
body: <p>I need to get the next item of the first loop given certain condition, but the condition is in the inner loop. Is there a shorter way to do it than this? (test code)</p>
  
  <pre><code>    ok = 0
      for x in range(0,10):
          if ok == 1:
              ok = 0
              continue
          for y in range(0,20): 
              if y == 5:
                  ok = 1
                  continue
  </code></pre>
  
  <p>What about in this situation?</p>
  
  <pre><code>for attribute in object1.__dict__:
      object2 = self.getobject()
      if object2 is not None:
          for attribute2 in object2: 
              if attribute1 == attribute2:
                  # Do something
                  #Need the next item of the outer loop
  </code></pre>
  
  <p>The second example shows better my current situation. I dont want to post the original code because it's in spanish. object1 and object2 are 2 very different objects, one is of object-relational mapping nature and the other is a webcontrol. But 2 of their attributes have the same values in certain situations, and I need to jump to the next item of the outer loop.</p>