if循环语法错误

时间:2012-11-12 08:42:21

标签: 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

2 个答案:

答案 0 :(得分:7)

试试这个:

if any(x in line for x in ('SU', 'AU', 'VU', 'rf')) and '/*' not in line and BUILDROOT in line:
    lineMatch = False

答案 1 :(得分:5)

不,if不应该在括号内。