In article 
<ca+rwobwjyy_abjijnxepkseraeom608uimywffgag-6xdgs...@mail.gmail.com>,
 Torgil Svensson <torgil.svens...@gmail.com> wrote:

> Try the fromiter function, that will allow you to pass an iterator
> which can read the file line by line and not preload the whole file.
> 
> file_iterator = iter(open('filename.txt')
> line_parser = lambda x: map(float,x.split('\t'))
> a=np.fromiter(itertools.imap(line_parser,file_iterator),dtype=float)
> 
> You have also the option to iterate the file twice and pass the
> "count" argument.

Thanks. That sounds great!

-- RUssell

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to