How can you read and print the lines containing the word "success" or "failure" from a log file named "logfile.txt"?
A:
with open("logfile.txt", "r") as file:
lines = file.readlines()
for line in lines:
if "success" in line.lower() or "failure" in line.lower():
print(line)
Discuss About this Question.