February 9th, 2005, 01:47 PM
Copying the contents of a file to a new file
Well I've never come across such a wierd problem like this before. If I use the following four lines:
in isolation as a complete program, then a text file with the exact number of lines as the original file 251326 lines is re-created.
corpus_tagwords = open("taggedwords.txt","r")
tempwords = corpus_tagwords.read()
corpus_tagwords = open("corpustaggedwords.txt","w")
If however, I use these four lines in a much longer program e.g. 300+ lines, for some reason the file that is recreated only contains 250617 lines and even more interestingly, the last line is only partially complete/visible!!! No idea what could be causing this as I'm sure nothing in the rest of the long program is interfering with these variables.
Has anybody else experienced this??? Any advice much appreciated.
February 9th, 2005, 02:21 PM
Problem Resolved. Remember kids... Always keep track of what files you've opened and 'forgot' :-( to close, its the little details that count in the world of programming. That's what many hours plugging away at this program does to you!!!