[Numpy-discussion] greedy loadtxt

lorenzo bolla lbolla@gmail....
Thu Mar 27 09:28:42 CDT 2008


Hi all!

I realized that numpy.loadtxt do not read the last character of an input
file. This is annoying if the input file do not end with a newline.
For example:

data.txt
-------
1 2 3<EOF>

In [33]: numpy.loadtxt('data.txt')
Out[33]: array([ 1.,  2.])


While:

data.txt
-------
1 2 3
<EOF>

In [33]: numpy.loadtxt('data.txt')
Out[33]: array([ 1.,  2., 3.])


Should I use numpy.fromfile, instead?
L.

-- 
Lorenzo Bolla
lbolla@gmail.com
http://lorenzobolla.emurse.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080327/1e8ed383/attachment.html 


More information about the Numpy-discussion mailing list