title: How can I save values in a text file?
body: <p>How can I save at each step of this loop the values of <code>out</code> in the text file <code>ctr_tr3.npt</code> in the same column (in <code>trib[PO4]</code>)?</p>
  
  <pre class="lang-py prettyprint-override"><code>N=5
  for i in xrange(N):
      os.chdir( 'c:\\Users\\Hidraulica\\Desktop\\w2furnas' )
      os.system( '"C:\\Users\\Hidraulica\\Desktop\\w2furnas\\w2.exe"' )
      shutil.move('tsr_1_seg6.opt', 'tsr_1_seg6.txt')
  
      data = np.genfromtxt('c:\\Users\\Hidraulica\\Desktop\\w2furnas\\tsr_1_seg6.txt', skip_header=11, names=True)
      input=np.array(data['PO4'])
  
      trib =np.genfromtxt('c:\\Users\\Hidraulica\\Desktop\\w2furnas\\ctr_tr3.npt', skip_header=2, names=True)
      out=np.array(trib['PO4'])
      out[i]= input[i]*0.75
  </code></pre>