summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/source/user/basics.io.genfromtxt.rst6
-rw-r--r--numpy/lib/npyio.py8
2 files changed, 8 insertions, 6 deletions
diff --git a/doc/source/user/basics.io.genfromtxt.rst b/doc/source/user/basics.io.genfromtxt.rst
index 11205e555..75ba8a11d 100644
--- a/doc/source/user/basics.io.genfromtxt.rst
+++ b/doc/source/user/basics.io.genfromtxt.rst
@@ -29,9 +29,9 @@ Defining the input
The only mandatory argument of :func:`~numpy.genfromtxt` is the source of
the data. It can be a string corresponding to the name of a local or
remote file, or a file-like object with a :meth:`read` method (such as an
-actual file or a :class:`StringIO.StringIO` object). If the argument is
-the URL of a remote file, this latter is automatically downloaded in the
-current directory.
+actual file or a :class:`StringIO.StringIO` object), a list of strings, or
+a generator. If the argument is the URL of a remote file, then the file
+is automatically downloaded to the current directory.
The input file can be a text file or an archive. Currently, the function
recognizes :class:`gzip` and :class:`bz2` (`bzip2`) archives. The type of
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index 12052a08e..9f90039eb 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -1271,10 +1271,12 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
Parameters
----------
- fname : file or str
- File, filename, or generator to read. If the filename extension is
+ fname : file, str, list of str
+ File, filename, list, or generator to read. If the filename extension is
`.gz` or `.bz2`, the file is first decompressed. Note that
generators must return byte strings in Python 3k.
+ The strings in a list or strings produced by a generator are treated
+ as lines.
dtype : dtype, optional
Data type of the resulting array.
If None, the dtypes will be determined by the contents of each
@@ -1455,7 +1457,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
fhd = iter(fname)
except TypeError:
raise TypeError(
- "fname must be a string, filehandle, or generator. "
+ "fname must be a string, filehandle, list of strings, or generator. "
"(got %s instead)" % type(fname))
split_line = LineSplitter(delimiter=delimiter, comments=comments,