[Numpy-discussion] loadtxt broken if file does not end in newline
David Huard
david.huard at gmail.com
Wed Feb 27 10:50:35 EST 2008
I can look at it.
Would everyone be satisfied with a solution using regular expressions ?
That is, looking for the following pattern:
pattern = re.compile(r"""
^\s* # leading white space
(.*) # Data
%s? # Zero or one comment character
(.*) # Comments
\s*$ # Trailing white space
"""%comments, re.VERBOSE)
match = pattern.search(line)
line, comment = match.groups()
instead of
line = line[:line.find(comments)].strip()
By the way, is there a test function for loadtxt and savetxt ? I couldn't
find one.
David
2008/2/26, Alan G Isaac <aisaac at american.edu>:
>
> On Tue, 26 Feb 2008, Lisandro Dalcin apparently wrote:
> > I believe the current 'loadtxt' function is broken
>
>
> I agree:
> <URL:
> http://projects.scipy.org/pipermail/numpy-discussion/2007-November/030057.html
> >
>
> Cheers,
>
> Alan Isaac
>
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080227/0bf7b13c/attachment.html>
More information about the NumPy-Discussion
mailing list