Name
xreadlines
Synopsis
xreadlines(f
)
Accepts argument f
, which must be a file
object or a file-like object with a readlines
method like that of file objects. Returns a sequence object
x
that is usable in a
for
statement or as the argument to built-in
functions such as filter
.
x
represents the same sequence of strings
as f
.readlines( )
, but
x
does so in a lazy way, limiting memory
consumption. xreadlines
is to
readlines
much like xrange
is
to range
.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.