[SciPy-User] genfromtxt but I need to search file first
Ben Harrison
ben.harrison at liquidmesh.com
Mon Apr 11 09:52:22 EDT 2011
Hi, I'm processing a bunch of text files with headers. The header is many
lines long, may be 43 lines, may be 42, maybe something else. The last line
of the header is always :
~ASCII section
After this there are columns of data that I want to load via genfromtxt
(mainly to strip leading spaces, and to load directly into an array).
Thing is, genfromtxt already loops twice through each file, so adding a bit
of code like this:
infile = open("my_text.txt","r")
text = infile.read()
infile.close()
means the file is read 3 times.
Is there another way? I'm new to python.
Ben.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110411/eee60210/attachment.html>
More information about the SciPy-User
mailing list