title: display an error message when file is empty - proper way?
body: <p>hi im slowly trying to learn the correct way to write python code. suppose i have a text file which i want to check if empty, what i want to happen is that the program immediately terminates and the console window displays an error message if indeed empty. so far what ive done is written below. please teach me the proper method on how one ought to handle this case:</p>
  
  <pre><code>import os
  
      def main():
  
          f1name = 'f1.txt'
          f1Cont = open(f1name,'r')
  
          if not f1Cont:
              print '%s is an empty file' %f1name
              os.system ('pause')
  
          #other code
  
      if __name__ == '__main__':
          main()
  </code></pre>