title: How to execute a python script and write output to txt file?
body: <p>I'm executing a .py file, which spits out a give string. This command works fine</p>
  
  <p>execfile ('file.py')</p>
  
  <p>But I want the output (in addition to it being shown in the shell) written into a text file.</p>
  
  <p>I tried this, but it's not working :(</p>
  
  <p>execfile ('file.py') > ('output.txt')</p>
  
  <p>All I get is this:</p>
  
  <p>tugsjs6555</p>
  
  <p>False</p>
  
  <p>I guess "False" is referring to the output file not being successfully written :(</p>
  
  <p>Thanks for your help</p>