[Numpy-discussion] loadtxt broken if file does not end in newline
Alan G Isaac
Thu Feb 28 00:12:02 CST 2008
> On Wed, 27 Feb 2008, Robert Kern apparently wrote:
>> Fixed in r4827.
> On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker wrote:
>> For the record, this is the fixed version:
>> comment_start = line.find(comments)
>> if comment_start > 0:
>> line = line[:comments_start].strip()
>> line = line.strip()
1. I do not see this change here:
Am I looking in the wrong place?
2. Can I assume this was not cut and past?
Otherwise, I see two problems.
2a. comment_start vs. comments_start (spelling)
2b. >0 instead of >=0 (e.g., "#try me!" would not be skipped)
So I think the desired lines are actually::
comment_start = line.find(comments)
if comment_start >= 0:
line = line[:comment_start].strip()
line = line.strip()
More information about the Numpy-discussion