what happens when the file begin read is too big for all lines to be?read with "readlines()"

Ben Finney bignose+hates-spam at benfinney.id.au
Sat Nov 19 06:48:59 EST 2005


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:

    <URL:http://docs.python.org/>

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.

    <URL:http://docs.python.org/lib/bltin-file-objects.html#l2h-244>

-- 
 \             "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 mailing list