[Numpy-discussion] greedy loadtxt

lorenzo bolla lbolla at gmail.com
Thu Mar 27 10:28:42 EDT 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 at gmail.com
http://lorenzobolla.emurse.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080327/1e8ed383/attachment.html>


More information about the NumPy-Discussion mailing list