Benny B
01-22-2002, 08:00 PM
Hey,
I've looked through the documentation and still not sure how to achieve this, or if it's possible.....basically I want to insert text at the start of a file.
I know I can append at the end of a file by using:
file = open('filename', 'a')
Also I know I could use readlines() then insert the text I need to into the list and then write all the lines back to the file....but that seems messy and I was wondering if there is a way to simply straight insert it into the start of the file, just like its possible to insert at the end of the file.
Thanks...
I've looked through the documentation and still not sure how to achieve this, or if it's possible.....basically I want to insert text at the start of a file.
I know I can append at the end of a file by using:
file = open('filename', 'a')
Also I know I could use readlines() then insert the text I need to into the list and then write all the lines back to the file....but that seems messy and I was wondering if there is a way to simply straight insert it into the start of the file, just like its possible to insert at the end of the file.
Thanks...