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.


> Importantly:
> 
>   os.rename(path, new_filename)
> 
> The old name comes first, then the new name.

Oops! I forgot about that.


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to