0

For whatever reason, my code is not entering the 'for' loop below in line 85.

The file input_fileA is open. Does anyone have a clue why? This is python 2.7.

 84 if (counter_shiftA == counter_shiftB):
 85     for line in input_fileA:
 86         print line
 87         if shiftBEntryA.strip() in line:
 88             print "Hit a matched line"
 89             counter1 += 1
 90             flag = True
 91             output_file.write(line)
 92         elif shiftEEntryA.strip() in line:
 93             output_file.write(line)
 94             break
 95         elif flag:
 96             output_file.write(line)
vaultah
  • 40,483
  • 12
  • 109
  • 137
Cookies Monster
  • 111
  • 1
  • 7

1 Answers1

1

You can try adding input_file1.seek(0) before for line in input_file1.readlines(): of line 87. Since, you mentioned you have called the line before. For more details, you can check discussion here

niraj
  • 15,852
  • 4
  • 32
  • 47