I'm trying to use python to search through a log file line by line.
I want to capture the line that contains both strings "apple" and "banana".
Some lines contain only "apple" and likewise some lines contain only "banana". How do I check if the line contains BOTH strings, and then go into my next condition?
Here is how I'm doing it now and it's not working yet.
APPLE = "APPLE"
FAILURE_MSGS {
    APPLE: "apple"
}
for line in out.splitlines():
    if FAILURE_MSGS[APPLE] and "banana" in line:
        <do something special with this line>
Something to note that you might notice, "apple" is predefined from someone else's list of expected failure messages and I am looking to find "banana" also, but I'm not supposed to add it to the dict of FAILURE_MSGS.
What ends up happening is it is with every line that has '"apple"' or '"banana"', not just when it finds both. Not sure why..
 
     
    