#Jay W. Summet # CS 1301, Released to the public domain october 2007 # #This funtion will copy the contents of the origin file #into the destination file while removing any lines that start with a # mark. def filterFile(origin, destination): inFile = open(origin, "r") outFile = open(destination, "w") FileNotEmpty = True while( FileNotEmpty) : fileContents = inFile.readline() if ( len(fileContents) == 0): FileNotEmpty = False else: if '#' == fileContents[0] : print "didn't write:", fileContents else: outFile.write(fileContents) outFile.close() inFile.close() filterFile("myFile.txt", "newOutFile.txt")