I have a large several hudred thousand lines text file. I have to extract 30,000 specific lines that are all in the text file in random spots. This is the program I have to extr
The best bet to speed it up would be if the specific string S0414
always appears at the same character position, so instead of having to make several failed comparisons per line (you said they start with different names) it could just do one and done.
e.g. if you're file has lines like
GLY S0414 GCT
ASP S0435 AGG
LEU S0432 CCT
do an if line[4:9] == 'S0414': small.write(line)
.