summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
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: