Jorge Godoy <[EMAIL PROTECTED]> writes:

> How about iterating through the file?  You can read it line by line, two lines
> at a time.  Pseudocode follows:
>
> line1 = read_line
> while line2 = read_line:
>       line_to_check = ''.join([line1, line2])
>       check_for_desired_string
>       line1 = line2
>
> With that you always have two lines in the buffer and you can check all of
> them for your desired string, no matter what the size of the file is.

This will fail if the string to search for is e.g. "\n\n\n\n" and it
actually occcurs in the file.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Skencil                                           http://skencil.org/
Thuban                                  http://thuban.intevation.org/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to