是否有与unless
Python 中的语句等效的语句?如果标签中有一行,我不想在标签上附加一行p4port
:
for line in newLines:
if 'SU' in line or 'AU' in line or 'VU' in line or 'rf' in line and line.find('/*') == -1:
lineMatch = False
for l in oldLines:
if '@' in line and line == l and 'p4port' not in line:
lineMatch = True
line = line.strip('\n')
line = line.split('@')[1]
line = line + '<br>\n'
labels.append(line)
if '@' in line and not lineMatch:
line = line.strip('\n')
line = line.split('@')[1]
line="<font color='black' style='background:rgb(255, 215, 0)'>"+line+"</font><br>\n"
labels.append(line)
我收到一个语法错误:
if '@' in line and not lineMatch:
UnboundLocalError: local variable 'lineMatch' referenced before assignment