Looping in Python and keeping current line after sub routine
<p>I've been trying to nut out an issue when looping in python 3.
When returning from sub routine the "line" variable has not incremented.</p>

<p>How do I get the script to return the latest readline from the 
subsroutine?</p>

<p>Code below</p>

<pre><code>def getData(line):
      #print(line)
      #while line in sTSDP_data:
      while "/service/content/test" not in line:
            line = sTSDP_data.readline()

import os, sys

sFileTSDP = "d:/ess/redo/Test.log"
sTSDP_data = open(sFileTSDP, "r")

for line in sTSDP_data:
      if "MOBITV" in line:
            getData(line)   #call sub routine
            print(line)
</code></pre>

<p>I'm stepping through a large file and on a certain string I need to call
a sub routine to process the next 5 (or 100) lines of data. When the sub routine completes and returns to the main program, it would be better to have it continue on from the last 
readline in the sub routine, not the last readline in the main program.</p>

<p>Daan's answer did the trick.</p>
