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.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index 303796d5f..5a3a077cb 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -748,7 +748,14 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, skiprows=0,
first_line = fhd.readline()
if first_line == '':
raise IOError('End-of-file reached before encountering data.')
- first_values = split_line(first_line)
+ if names is True:
+ first_values = first_line.strip().split(delimiter)
+ else:
+ first_values = split_line(first_line)
+ if names is True:
+ fval = first_values[0].strip()
+ if fval in comments:
+ del first_values[0]
# Check the columns to use
if usecols is not None: