On 1 May 2007 16:03:28 -0700, JonathanB <[EMAIL PROTECTED]> wrote: > Ok, so this is the scenario. I need to create a simple, no-frills XML > editor for non-technical users. It doesn't have to do anything fancy, > what I want is a series of text boxes with the text contents of the > elements pre-printed. Then the users can type their changes into the > text boxes and click submit and it will load the changes in. So here > is the problem, this means I need to open the same file as both read > and write. How do I do this? I'm slowly learning the DOM stuff that I > need to know to do this, but this file thing I haven't been able to > find anywhere. > > JonathanB
Well the most straight forward approach is to read data from the file into memory. Let the user make any changes. Then save the data back to the file, overwriting the oringinal copy. Now, this only really works if you're dealing with small files. Regardless though, you never really need to have a file open for both reading and writing. Since they occur (so it sounds) at distinct times during your program flow, just open it twice: the first to read, the second to write. Ian -- http://mail.python.org/mailman/listinfo/python-list