READ FILE UNTIL THE Xth SPACE IS ENCOUNTERED...
Travis Oliphant
oliphant at ee.byu.edu
Wed Oct 17 11:28:53 EDT 2001
> Hi list :-)
>
> Motivation: I have massiv ASCII files containing floats delimited by spaces
> and run out of memory when trying to get them into the machine in one piece
> (followed by spliting into a list object).
>
In the SciPy package there is a function called io.read_array that you
should look into.
It reads ascii data into Numeric arrays. help(io.read_array) after a from
scipy import * will show you how it works.
It may not be fast enough, but it should be as fast as any line-by-line
method.
There is a package out there called TableIO that is quite fast but
requires compilation. It's old and I'm not sure if it is available
anymore.
There is also a function in Konrad Hinsen's Scientific Python that reads
ascii data into arrays.
Good luck,
-Travis
More information about the Python-list
mailing list