I'd like to take a text file, and for each line, try to comment that line (write to file), check whether an external script works, and if not, uncomment it. Finally, this should result in a txt file with unnecessary code lines commented out.
I tried to copy the text file into a list, and then iterate over it, each time writing the entire file. Is there a better solution?