title: Update iteration value in Python for loop
body: <p>Pretty new to Python and have been writing up a script to pick out certain lines of a basic log file</p>
  
  <p>Basically the function searches lines of the file and when it finds one I want to output to a separate file, adds it into a list, then also adds the next five lines following that.  This then gets output to a separate file at the end in a different funcition.</p>
  
  <p>What I've been trying to do following that is jump the loop to continue on from the last of those five lines, rather than going over them again.  I thought the last line in the code would solved the problem, but unfortunately not.</p>
  
  <p>Are there any recommended variations of a for loop I could use for this purpose?</p>
  
  <pre><code>def readSingleDayLogs(aDir): 
  print 'Processing files in ' + str(aDir)    + '\n'
  lineNumber = 0
  try:
      open_aDirFile = open(aDir)  #open the log file
      for aLine in open_aDirFile: #total the num. lines in file
          lineNumber = lineNumber + 1
      lowerBound = 0
      for lineIDX in range(lowerBound, lineNumber):          
          currentLine = linecache.getline(aDir, lineIDX)
          if (bunch of logic conditions):
                      issueList.append(currentLine)
                      for extraLineIDX in range(1, 6): #loop over the next five lines of the error and append to issue list
                          extraLine = linecache.getline(aDir, lineIDX+ extraLineIDX) #get the x extra line after problem line
                          issueList.append(extraLine)
                      issueList.append('\n\n')
                      lowerBound = lineIDX
  </code></pre>