Le vendredi 15 juin 2018 12:36:40 UTC+2, Steven D'Aprano a écrit :
> On Fri, 15 Jun 2018 01:01:03 -0700, francois.rabanel wrote:
>
> > I work with a file which contains millions lines, a simply file.read()
> > and I'm running out of memory
>
> Assuming each line is on average a hundred characters
Le vendredi 15 juin 2018 02:42:12 UTC+2, Cameron Simpson a écrit :
> On 15Jun2018 00:24, Steven D'Aprano
> 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 o
Hi,
Here is my script :
It propose to replace some words in a file with a regular expression.
It create a copy to write on it, and if there isn't an error, it delete the
original by the copy with "os.rename" at the end.
My problem is, if I work on a huge file, I'll try to avoid to read the file