On 15Jun2018 00:24, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> 
wrote:
On Fri, 15 Jun 2018 10:00:59 +1000, Cameron Simpson wrote:
Francois, unless your regex can cross multiple lines it is better to
search files like this:

  with open(the_filename) as f:
    for line in f:
      ... search the line for the regexp ...

That way you only need to keep one line at a time in memory.

That's what François is doing.

Urr, so he is. Then like you, I don't know why he's concerned about running out of memory. Unless it hasn't been made clear the Python will free up unused memory on its own.

Cheers,
Cameron Simpson <c...@cskk.id.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to