On Fri, May 20, 2005 at 01:48:19PM -0500, Kristian Zoerhoff wrote: >On 5/20/05, William O'Higgins <[EMAIL PROTECTED]> wrote: >> When I am open()-ing a file, I sort of expect that if the file doesn't >> exist that it would be created, but it doesn't, it whines about it >> instead. So, how do I create a file with Python? I've looked all over, >> but I'm obviously missing something. Thanks. > >How are you opening the file? It will be created if you open in write >or append mode (w or a), but not in read-only (r) mode.
Fascinating. I was opening the file read-write (r+) and it didn't work. Are there only the few file-access methods (read (r), write (w), append (a) and read-write (r+))? Sometimes I like to prepend or to clobber or to address in binary mode - are these things possible, or do I have to seek() to prepend and delete to clobber? Thanks. -- yours, William
signature.asc
Description: Digital signature
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor