title: Unable to loop over a file using context manager python3
body: <pre><code>instances = ['XYZ']
  curr_date = time.strftime(&quot;%Y%m%d&quot;)
      
      for inst_name in instances:
          with open(f'results_{inst_name}_master.csv') as f:
              pkt_name = f.readline().split(';')[1]
              print(f&quot;package name is: {pkt_name}&quot;)
              run_dt = f.readline().split(';')[1]
              print(f&quot;run date: {run_dt}&quot;)
              time_check = f.readlines()[1].split(';')[-5].split(':')[0]
              print(f&quot;time is : {time_check}&quot;)
              if ((run_dt == curr_date) or (run_dt &lt; curr_date and time_check in range(20,24))):
                  for index, l in enumerate(f, 1):
                      if 'remoteInstallation' in l:
                          print(l)
  </code></pre>
  <p>Sample file:</p>
  <pre><code>pktName;sample-quality.zip;
  RunDate;20220116;
  sample:path_to_test\test;20220116;01:29:13;20220114;01:33:36;0:04:22;
  ;sample:path\to\remoteInstallation;45.99;../logs_path/index.html;OK;
  ;sample:path\to\remoteInstallation;42.87;../logs__other_path/index.html;1
  </code></pre>
  <p>I'm getting all the results except <code>print(l)</code>, that is , it's unable to loop over the file although the string : 'remoteInstallation' is present in the file.</p>
  <p>Please note that in actual, the file contains the newline characters(\n) at the end of each line.</p>
  <p>What am i doing wrong here?</p>
  <p>Thanks in advance!</p>