Wayne Watson wrote:
Enclosed is a segment of a program which copies a txt file, but replaces the first line with a new one. The new one has a suffix of tmp. After it executed the code and exited the program normally (running out of code), I couldn't access the new tmp file. It was listed by Win XP, but I got a "file in use" messge. Do I have to exit differently to free the tmp file for inspection? I don't have the answer - but a suggestion for cleaner code. Note I added \n at the end of the header! input_file.readline() # discard first line output_file.write("Event time: " + new_event_date + "\n") # replace header output_file.write(input_file.read()) # copy rest of file - assuming file is not BIG output_file.close() -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in learning this process. What is YOUR biggest relationship challenge? |
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor