title: How to continue enumarete() loop in other loop
body: <p>I'm stuck with this:</p>
  <p>I want to grab the future 12 lines from my files when it finds '/MAT/LAW02/1' to write it, in a second file.</p>
  <p>And after that, I want it to keep analyzing until the end.</p>
  <p>But I'm stuck because I can never find a topic on this problem.</p>
  <p>Here is my current code:</p>
  <pre><code>inputRadFile = &quot;demo/textA.txt&quot;
  outputRadFile = &quot;demo/textB.txt&quot;
  
  with open(outputRadFile, &quot;w&quot;) as textFileClean:
      with open(inputRadFile, &quot;r&quot;) as textFile:
          for i, line in enumerate(textFile):
              if '/MAT/LAW02/1' in line:
                  catchInfo = line.strip().split()
                  toString = ''.join(catchInfo)
                  textFileClean.write(toString)
      textFile.close()
  textFileClean.close()
  </code></pre>
  <p>This is a snippet of textA file that I want to extract (because the textA file has 200,000 lines) :</p>
  <pre><code>/MAT/LAW02/1
  ES_ODG2_MED-5                                                                                      
  #                RHO|           REF. RHO|
               7.82E-9
  #                  E|                  v|
               210000.                 0.3
  #                  a|                  b|                  n|               emax|               smax|
                 273.1               437.6               0.724               1.E30               1.E30
  #                  c|                 e0|      ICC|  Fsmooth|               Fcut|              Chard|
                 0.097                0.32         1         0               1.E30
  #                  m|              Tmelt|             rho0Cp|                 Ti|
                    0.                  0.                  0.                298.
  </code></pre>
  <p>And here is my textB file after running the above code:</p>
  <pre><code>/MAT/LAW02/1
  </code></pre>
  <p>And I thought of something like this:</p>
  <pre><code>from itertools import islice
  
  inputRadFile = &quot;demo/textA.txt&quot;
  outputRadFile = &quot;demo/textB.txt&quot;
  
  with open(outputRadFile, &quot;w&quot;) as textFileClean:
      with open(inputRadFile, &quot;r&quot;) as textFile:
          it = iter(enumerate(textFile))
          for i, line in it:
              x = 0
              y = 12
              if '/MAT/LAW02/1' in line:
                  while x != y:
                      catchInfo = line.strip().split()
                      toString = ''.join(catchInfo)
                      textFileClean.write(toString)
                      place_where_skip_happened = i
                      next(islice(it, 1, 1), None)
                      x += 1
      textFile.close()
  textFileClean.close()
  </code></pre>
  <p>I wanted to go from 1 by 1 to 12.</p>
  <p>I was inspired by this topic : <a href="https://stackoverflow.com/questions/28138392/skip-iterations-in-enumerated-list-object-python">Skip iterations in enumerated list object (python)</a></p>
  <p>But it does not work for me.</p>
  <p>Here is my textB file after running this code:</p>
  <pre><code>/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1/MAT/LAW02/1
  </code></pre>
  <p>The separator is not a problem at the moment (I know how to do it).</p>
  <p>At the end I want a textB like the snippet of textA.</p>
  <p>Someone can help me ?</p>