I am trying to print all the below content of text file once a keyword is encountered using python.
Below is the code which I have written.
Filepath="D:/xyz.txt"
with open(filepath)as fp
for line in fp:
for path in line.split(" ")
if "error" or "exception " in fp:#It #should print all the content after error or #exception in line
print line