-1

i want to check if 3 keywords are in line, the keywords being

( ,) and module

I tried

if "(" or ")" or "module" in line:

That didn't work. How do I check it?

Illusionist
  • 5,204
  • 11
  • 46
  • 76

1 Answers1

2

You need to change it to following :

if "(" in line or ")" in line or "module" in line:

Actually your command is equal to if True or True or "module" in line:

Boolean operations :

In the context of Boolean operations, and also when expressions are used by control flow statements, the following values are interpreted as false:

False, None, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true.

Community
  • 1
  • 1
Mazdak
  • 105,000
  • 18
  • 159
  • 188