summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorpierregm <pierregmcode@gmail.com>2010-11-13 17:54:44 +0100
committerpierregm <pierregmcode@gmail.com>2010-11-13 21:19:50 +0100
commitfad376ead11b8e0f3101d37b62b0c8d5ba40af72 (patch)
tree3c55bd1544785d4a35d046290c22f53f958b72a4 /numpy
parenta9d936ee92b1732256e30db44377b53769e6241e (diff)
downloadnumpy-fad376ead11b8e0f3101d37b62b0c8d5ba40af72.tar.gz
Fix bug #1656
Diffstat (limited to 'numpy')
-rw-r--r--numpy/lib/_iotools.py2
-rw-r--r--numpy/lib/tests/test_io.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py
index 451f0f610..8a0697d58 100644
--- a/numpy/lib/_iotools.py
+++ b/numpy/lib/_iotools.py
@@ -209,7 +209,7 @@ class LineSplitter:
return line.split(self.delimiter)
#
def _fixedwidth_splitter(self, line):
- line = line.split(self.comments)[0]
+ line = line.split(self.comments)[0].strip(asbytes("\r\n"))
if not line:
return []
fixed = self.delimiter
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 1f4ed0a01..81e15119b 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -769,6 +769,13 @@ M 33 21.99
[ 6., 7., 8., 9., 10.]])
assert_equal(test, control)
+ def test_integer_delimiter(self):
+ "Test using an integer for delimiter"
+ data = " 1 2 3\n 4 5 67\n890123 4"
+ test = np.genfromtxt(StringIO(data), delimiter=3)
+ control = np.array([[1, 2, 3], [4, 5, 67], [890, 123, 4]])
+ assert_equal(test, control)
+
def test_missing(self):
data = StringIO('1,2,3,,5\n')