Python if循环语法错误
Python中的以下语法正确吗Python if循环语法错误,python,Python,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
(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
之前删除(
)。