Re: moving data from one place to another in a text file

From: Richard (riplin_at_Azonic.co.nz)
Date: 02/18/05


Date: 18 Feb 2005 10:24:48 -0800


> Otherwise it might be better to copy the ...

In my view the simpler the program the 'better' it is. Copying the
file, or parts of it, somewhere else: a temporary file or some
in-memory structure; just complexifies the program and gives more
points where it may be miscoded, or could go wrong.

I doubt that using a temporary file would make the program use less
resources overall (which may be why you thought it 'better'). Reading
the input twice, especially as it is likely to be cached for the 2nd
pass, is probably much faster than opening a new temporary file to be
written and read back for part of the data.

> The best solution might be to tell the manager to supply the two
> records to be inserted separately.

Which could be easily achieved by having the code you quoted as a
separate program and added to by writing a and b to a new file.

That would qualify in my view as 'better' because we now have two
programs but each is simpler.



Relevant Pages

  • File-writing not working in Windows?
    ... copying = False ... and written to the temporary file in tempdir. ... It does not work in Windows. ... cutting an HTML file at predetermined comment sections, ...
    (comp.lang.python)
  • Re: POST $_FILES
    ... because the server deletes the temporary file immediately. ... could try copying the temporary file to a different filename but I ...
    (comp.lang.php)
  • Writing Files to CD - Cant delete Temp File
    ... Temporary File Waiting to be written to the CD. ... copying any other files to a CD. ... remove this Temproary file ?? ...
    (microsoft.public.windowsxp.accessibility)
  • Re: faulty save
    ... temporary file is deleted. ... How, exactly, are you opening the document? ... (including backing it up to a flash drive), I went to work on it today to ... Is my data lost forever or is there someway to get my data back? ...
    (microsoft.public.word.docmanagement)
  • Re: command failed to execute.
    ... then the double arrows to the right opening IE8. ... The default entry causes that the a temporary file needed for opening ... Taking this route is easy enough and provides the normal access to ...
    (microsoft.public.windows.vista.mail)