|
5.12 xreadlines -- Efficient iteration over a file
New in version 2.1.
This module defines a new object type which can efficiently iterate
over the lines of a file. An xreadlines object is a sequence type
which implements simple in-order indexing beginning at Thus, the code
has approximately the same speed and memory consumption as
except the clarity of the for statement is retained in the former case.
An xreadlines object s supports the following sequence operation:
If successive values of i are not sequential starting from
After the last line of the file is read, this code will raise an IndexError. See About this document... for information on suggesting changes. |