Loading file data into NumPy arrays

A special module loads tabular file data into NumPy arrays:
import scitools.filetable
f = open(infilename, 'r')
x, y = scitools.filetable.read_columns(f)
f.close()
Now we can compute with the NumPy arrays x and y:
x = 10*x
y = 2*y + 0.1*sin(x)
We can easily write x and y back to a file:
f = open(outfilename, 'w')
scitools.filetable.write_columns(f, x, y)
f.close()

previousnexttable of contents