what happens when the file begin read is too big for all lines tobe?read with "readlines()"
rossreyes at rcn.com
Sat Nov 19 14:01:36 CET 2005
Yes, I have read this part....
Read until EOF using readline() and return a list containing the lines thus
read. If the optional sizehint argument is present, instead of reading up to
EOF, whole lines totalling approximately sizehint bytes (possibly after
rounding up to an internal buffer size) are read. Objects implementing a
file-like interface may choose to ignore sizehint if it cannot be
implemented, or cannot be implemented efficiently.
Maybe I'm missing the obvious, but it does not seem to say what happens when
the input for readlines is too big. Or does it?
How does one tell exactly what the limitation is to the size of the
returned list of strings?
----- Original Message -----
From: "Ben Finney" <bignose+hates-spam at benfinney.id.au>
To: <python-list at python.org>
Sent: Saturday, November 19, 2005 6:48 AM
Subject: Re: what happens when the file begin read is too big for all lines
tobe?read with "readlines()"
> Ross Reyes <rossreyes at rcn.com> wrote:
>> Sorry for maybe a too simple a question but I googled and also
>> checked my reference O'Reilly Learning Python book and I did not
>> find a satisfactory answer.
> The Python documentation is online, and it's good to get familiar with
> It's even possible to tell Google to search only that site with
> "site:docs.python.org" as a search term.
>> When I use readlines, what happens if the number of lines is huge?
>> I have a very big file (4GB) I want to read in, but I'm sure there
>> must be some limitation to readlines and I'd like to know how it is
>> handled by python.
> The documentation on methods of the 'file' type describes the
> 'readlines' method, and addresses this concern.
> \ "If you're not part of the solution, you're part of the |
> `\ precipitate." -- Steven Wright |
> _o__) |
> Ben Finney
More information about the Python-list