title: Python print to file function is not printing to file
body: <p>I am using the print function with output to file argument. The print function is under an if statement. Below is the code</p>
  
  <pre><code>log_file = open("Src_files.log", 'w') 
  if count_1.equals(count_2) == False:
      print('Error: Discrepancy with processed file. Count of records does not match with sources file', file=log_file) 
  </code></pre>
  
  <p>Count_1 and count_2 are unequal dataframes</p>
  
  <p>The code gets executed without throwing any error but when I check the log file, it does not contain the printed statement.</p>
  
  <p>How do I correct the code?</p>