Hi i'm trying to delete a line in my file but want to keep the rest of my lines.
f = open("myfile.html").read()
lines = f.readlines()
a = findall('<h2>\$.*', f)
f.close()
f = open("myfile.html","w")
for line in lines:
if line!= a[0]:
f.write(line)
f.close()
When I use the code above, all my other lines in the file of my html is removed.
text trying to get rid of:
<h2>Thank you</h2>
<h2>Please come again</h2> #Get rid of this line