Looping in Python and keeping current line after sub routine [migrated]
- by Brendan
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.
How do I get the script to return the latest readline from the
subsroutine?
Code below
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)