I have a code which is using with statement to read a file line by line. The below code goes in infinite loop where line:1 is printed everytime. Not sure what mistake I am doing
with open (config_file) as fp:
line = fp.readline()
print("line is", line)
while line:
match = re.search("^QueueDir\s*=\s*(.*)$", line)
if (match.group(1)):
return match.group(1)