Hi Resmi On Tue, Aug 13, 2013 at 2:20 PM, Resmi <[email protected]> wrote: > I've a list of long files of numerical data ending with footer lines > (beginning with #). I am using numpy.loadtxt to read the numbers, and > loadtxt ignores these footer lines. I want the numpy code to read one of the > footer lines and extract words from it. Is there a way to use loadtxt for > this? If there weren't many files I could have used the line number (which > keep varying between the files) of the footer line along with linecache. > Nevertheless there should be a generic way to do this in numpy?
If the data-set is not too big, you can read it into memory with "f.readlines()" and then do a bit of preparsing on the resulting array before sending the rest of it to np.loadtxt (which allows an array of strings as input). Stéfan _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
