summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-01-23 11:33:53 -0500
committerCharles Harris <charlesr.harris@gmail.com>2015-01-23 11:33:53 -0500
commitd44604ef625ff38e835a51cad3bcd24400278eff (patch)
treec14fa76687ccf967b7a2d6752acbd8020e7b1e49 /numpy/lib/npyio.py
parent5b714c7ecd46ed8e730afc8f37f8b8d1faf36497 (diff)
parent8697b9cc58815efb16045542833ee30f2623325b (diff)
downloadnumpy-d44604ef625ff38e835a51cad3bcd24400278eff.tar.gz
Merge pull request #5489 from charris/cleanup-gh-5156
Cleanup gh 5156
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index bedd0e941..a40de4fea 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -729,7 +729,8 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None,
"""
# Type conversions for Py3 convenience
- comments = asbytes(comments)
+ if comments is not None:
+ comments = asbytes(comments)
user_converters = converters
if delimiter is not None:
delimiter = asbytes(delimiter)
@@ -802,7 +803,10 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None,
def split_line(line):
"""Chop off comments, strip, and split at delimiter."""
- line = asbytes(line).split(comments)[0].strip(asbytes('\r\n'))
+ if comments is None:
+ line = asbytes(line).strip(asbytes('\r\n'))
+ else:
+ line = asbytes(line).split(comments)[0].strip(asbytes('\r\n'))
if line:
return line.split(delimiter)
else: