This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / Built-in Functions / Input and Output / File Input /

ReadList

FilledSmallSquare ReadList["file"] reads all the remaining expressions in a file, and returns a list of them.

FilledSmallSquare ReadList["file", type] reads objects of the specified type from a file, until the end of the file is reached. The list of objects read is returned.

FilledSmallSquare ReadList["file", , , ... ] reads objects with a sequence of types, until the end of the file is reached.

FilledSmallSquare ReadList["file", types, n] reads only the first n objects of the specified types.

FilledSmallSquare The option setting RecordLists -> True makes ReadList create separate sublists for objects that appear in separate records.

FilledSmallSquare With the default setting RecordSeparators -> {"\n"}, RecordLists -> True puts objects on separate lines into separate sublists.

FilledSmallSquare The option RecordSeparators gives a list of strings which are taken to delimit records.

FilledSmallSquare ReadList takes the same options as Read, with the addition of RecordLists.

FilledSmallSquare If file is not already open for reading, ReadList opens it, then closes it when it is finished. If the file is already open, ReadList does not close it at the end.

FilledSmallSquare ReadList prints a message if any of the objects remaining in the file are not of the specified types.

FilledSmallSquare ReadList["file", , ... ] looks for the sequence of in order. If the end of file is reached while part way through the sequence of , EndOfFile is returned in place of the elements in the sequence that have not yet been read.

FilledSmallSquare ReadList[stream] reads from an open input stream, as returned by OpenRead.

FilledSmallSquare See notes for Read.

FilledSmallSquare See Section 1.11.10 and Section 2.12.8.

FilledSmallSquare See also: Import, FindList.

FilledSmallSquare New in Version 1.

Further Examples