title: Readlines() and calculations in for loop
body: <p>I have a very long txt file with basically this structure:</p>
  
  <pre><code>   -97990.580   316472.190   452.080
     -97990.580   316472.190   452.070
     -97990.570   316472.190   452.060
     -97990.600   316472.190   452.040
  </code></pre>
  
  <p>So three blank at the beginning and three blank in between as separator.</p>
  
  <p>I want to subtract a constant value (-316400,00) from column 2. I made a for loop that reads each line and strips each value in a single variable. Looks like this atm:</p>
  
  <pre><code>lineno=0            #Count lines
  output_text = ""    #string variable holding all text to be written to   output file
  
  for filen in change:
      lineno += 1
      finput = file(filen, "r")
      data = finput.readlines()
      linesplit = [elem.strip().split('   ') for elem in data]
      x = linesplit[0]
      print x
      y = linesplit[1] #-316400,00
     print y
     z = linesplit[2]
     print z
     output_text += "%s   %s   %s\n" % (x, y, z)   
     fileout.write(output_text)
     finput.close()
  fileout.close()
  </code></pre>
  
  <p>Now the output file looks like this:</p>
  
  <pre><code>['-97990.580', '316472.190', '452.080']   ['-97990.580', '316472.190', '452.070']   ['-97990.570', '316472.190', '452.060']
  </code></pre>
  
  <p>It reads every row in the original text file as an element of a single list (if I print lineno it's 1). Also this way of course the subtraction for the y variable does not work. I used this strange looking linestrip variable as linesplit = data.strip().split("   ") but does not work for lists ('list' object has no attribute 'readlines')</p>
  
  <p>Any help here? The output should basically look like this:</p>
  
  <pre><code>  -97990.580   472.190   452.080
    -97990.580   472.190   452.070
    -97990.570   472.190   452.060
    -97990.600   472.190   452.040
  </code></pre>