Re: [Tutor] use gzip with large files

2005-07-19 Thread Hugo González Monteverde
You're s right. missed that one, sorry... Kent Johnson wrote: > Hugo González Monteverde wrote: > >>for a file-like object with a read method: >> >>for line in file: >> if not line: >> break > > > The test > if not line: > break > is not needed with this form of looping; t

Re: [Tutor] use gzip with large files

2005-07-19 Thread Kent Johnson
Hugo González Monteverde wrote: > for a file-like object with a read method: > > for line in file: > if not line: > break The test if not line: break is not needed with this form of looping; the loop will end automatically when it gets to the end of the file. > > line will

Re: [Tutor] use gzip with large files

2005-07-19 Thread Hugo González Monteverde
for a file-like object with a read method: for line in file: if not line: break line will be "" for EOF, "\n" for an empty line. This will not read the whole file to RAM at once. I'm not familiar with the gzip module, but if the read() solution works for small files, the one I pr

Re: [Tutor] use gzip with large files

2005-07-19 Thread Kent Johnson
Adam Bark wrote: > If you use something like this: > > for line in file.readlines(): This will read the whole file into a list of lines; the OP doesn't want to read the whole file at once. > then line is a string to the next newline and it automatically detects > the EOF and the same with file

Re: [Tutor] use gzip with large files

2005-07-19 Thread Adam Bark
If you use something like this: for line in file.readlines(): then line is a string to the next newline and it automatically detects the EOF and the same with file.readline() but that will give you one character at a time.On 7/19/05, frank h. <[EMAIL PROTECTED]> wrote: hello allI am trying to wri