2
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
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
試試這個:
if any(x in line for x in ('SU', 'AU', 'VU', 'rf')) and '/*' not in line and BUILDROOT in line:
lineMatch = False
不,if
不應位於括號內。
的'if'語句不啓動循環。 – Matthias
運行你的代碼的結果是什麼?你得到的例外應該告訴你它不正確。 – Ber
你應該從'if'之前刪除'(''。 – Bakuriu