summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
authorRobert Kern <robert.kern@gmail.com>2008-02-27 22:56:07 +0000
committerRobert Kern <robert.kern@gmail.com>2008-02-27 22:56:07 +0000
commita5615d4917a25331e008959c55cb5de16b7d164c (patch)
tree2ed23b34d871a8c1cffff85ab1168eb807d66406 /numpy/lib/io.py
parent984bd6ce8c464f921d273898a2546506778986a7 (diff)
downloadnumpy-a5615d4917a25331e008959c55cb5de16b7d164c.tar.gz
Handle the no-comment case correctly.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index aa832487f..dce93af76 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -293,7 +293,11 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None,
for i,line in enumerate(fh):
if i<skiprows: continue
- line = line[:line.find(comments)].strip()
+ comment_start = line.find(comments)
+ if comment_start > 0:
+ line = line[:comments_start].strip()
+ else:
+ line = line.strip()
if not len(line): continue
vals = line.split(delimiter)
if converterseq is None: