0

I am currently using if "not" or "missing" in temp_reader:

However, it looks like it is not working. It always go inside of the if loop even if not or missing is not there.

How can I fix this, so that it only foes inside of the loop if a text file contains not or missing?

Tim
  • 103
  • 2
  • 8

1 Answers1

2

Change to something like this:

if "not" in temp_reader or "missing" in temp_reader:

The original condition was being parsed like this:

if ("not") or ("missing" in temp_reader):

Since "not" always evaluates to True, the branch was being taken every time.

Kevin
  • 27,317
  • 8
  • 56
  • 78