This is a sample input file:
abcd
efgh
#^&
abcd
efgh
This is the required output for the file:
#^& (#these symbols must be part of the output file)
abcd
efgh
How can I delete all the lines before the special characters without affecting identical/near identical lines that come after? I have about 500 files in which I need this to be done.
I'm a beginner and this is how far I've gotten:
myfile = open("3Attrimmed.txt", "rt") #opens the file
#readfile = myfile.read() #reads the file
lines = myfile.readlines()
finaltxt = ("finaltxt.txt", "w+")
for line in lines:
if ">" not in line:
line.strip() #removes the line
else:
print line
break