Bulding arrays from text file data.

Joe Woodward joe.woodward at padtinc.com
Tue Apr 30 19:18:16 EDT 2002


Does anyone know of a faster way to build an array out of text file
with formatted data. What I have been doing works well, but now my
files and 200MB and up. The following way builds a Numeric.array
without knowing the size to start with. I can then resize it after the
fact.


yldpos=Numeric.array(map(float,re.split('\s+',string.strip(open('datafile.txt').read()))))

yldpos.shape=(len(yldpos)/5,5)


Thank you,

Joe Woodward 
PHoenix Analysis & Design Technologies



More information about the Python-list mailing list