I would like to read data from an .asc file with a six-line file header. I just want the data without the header. I'd like to start at the 7th line and go until the end collecting the data into a single list. Each different data file I'm looping through has a different number of rows. I started with 6 "readlines" for dumping and then a 'while' statement to read and append the lines until the end of the data set. However, this produces a list of length 2045. I was hoping it would be of the length of the number of data values in the dataset (or the number of rows times the number of columns as it is a data matrix). It seems the function float doesn't work for assignment from readline either. Might anyone have an ideas about a better way to go about it? I also attached an example of a data file.
Here's my current code:
import sys, string, os, arcgisscripting, copy, glob from quantile import quantile gq= x=open(r'C:\PYTHON_SCRIPTS\GETSTATS\asc\darmein1.txt','r') x.readline() x.readline() x.readline() x.readline() x.readline() x.readline() z= x.readline() gq.append(z) while z != '': z=x.readline() gq.append(z) len(gq)### but len(gq)= 2045 when there are 2044 rows and 1422 columns in the original data set?? I was hoping for 2044*1422 strings (or data values) to turn into floats using... float(gq) ###but float returns error: File "<interactive input>", line 1, in ####<module> TypeError: float() argument must be a string or a number x.close()