On 3/17/11 12:46 AM, eat wrote: > I am try to read a file of the following format, I want to avoid > the first line and read the remaining as 'float' . > Please help me... > > > Rain Wind Temp Pr Sal > 0.1 1.1 0.02 0.2 0.2 > 0.5 0. 0. 0.4 0.8 > 0.5 5.5 1.5 0.5 1.5
It's not as robust, but if performance matters, fromfile() should be faster: f.readline() # to skip the first line arr = np.fromfile(f, sep=' ', dtype=np.float64).reshape((-1, 5)) (untested) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion