[Tutor] creating files on open()

Alan G alan.gauld at freenet.co.uk
Sat May 21 01:41:38 CEST 2005


> to address in binary mode - are these things possible, or do I have
to
> seek() to prepend and delete to clobber?  Thanks.

Using seek() will not prepend it will overwrite!
To prepend you will have to write out your preamble then append
the existing data to that.

There is no random access mechanism in Python other than seek()
You can't create fixed length records and navigate through them
as you can in some other languages. (you can of course use
format strings to fake this but its messier than true random
record access)

Alan G.



More information about the Tutor mailing list