2

Is the following syntax right in Python?

(if 'SU' in line or 'AU' in line or 'VU' in line or 'rf' in line and line.find('/*') == -1) and (BUILDROOT in line):
    lineMatch = False
3
  • The if-statement does not start a loop. Commented Nov 12, 2012 at 8:45
  • What is the result of running your code? The exception you get should tell you its not correct. Commented Nov 12, 2012 at 9:03
  • 1
    You should remove the ( from before the if. Commented Nov 12, 2012 at 9:07

2 Answers 2

7

Try this:

if any(x in line for x in ('SU', 'AU', 'VU', 'rf')) and '/*' not in line and BUILDROOT in line:
    lineMatch = False
Sign up to request clarification or add additional context in comments.

Comments

5

No, the if should not be inside the brackets.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.