Hi All,
 
I have a list containing 108 filenames. I want to open each file and write it to an output file, appending it to the previous write. I use the code below. Everything appears to work fine until I reach file 107. Only part of the file is written, and file 108 is not written at all. The program runs to completion (I get exit code 0). I debugged the problem and found that readlines() is reading all of file 107's contents but that writelines() is not writing all of file 107's contents. There are no strange characters where the write stops.
 
Any advice would be greatly appreciated.
Thanks,
Lance
-----------------------------------------------------------------
fileobjectw = open(COMPILETRACEDIR + '\\IncludeCode.prg', 'w')
for line in listext:
    line = string.strip(line)
    fileobjectr = open(line, 'r')
    sa = fileobjectr.readlines()
    fileobjectr.close()
    fileobjectw.writelines(sa)
fileobjectw.close()
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to