How to add lines to the beginning of a text file?
joncle at googlemail.com
Sat Apr 4 03:50:22 CEST 2009
On 4 Apr, 02:21, dean <de... at yahoo.com> wrote:
> As the subject says how would I go about adding the lines to the beginning
> of a text file? Thanks in advance.
I'd create a new file, then write your new lines, then iterate the
existing file and write those lines... If no errors occcur, issue a
delete for the old file, and a rename for new file to the old name.
More information about the Python-list