I have an html file where I want to remove all lines above the line starting with string
HTTP/1.1 400 Bad Request Content-Type: text/html; charset=utf-8 Date: Sat, 22 Mar 2015 07:56:52 Connection: close Content-Length: 2959 <!DOCTYPE html...... extra lines ...
So when I search for the occurrence of string
<!DOCTYPE I need to remove all lines including blank ones above this particular line. In linux we have an option in
grep which can search for the lines above and below and then delete it. Can we do a similar thing in Python?