Esiste un equivalente all'istruzione unless
in Python? Non voglio per aggiungere una linea ad un'etichetta se ha p4port
in esso:tranne istruzioni in Python
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)
ottengo un errore di sintassi:
if '@' in line and not lineMatch:
UnboundLocalError: local variable 'lineMatch' referenced before assignment
come modificare la mia istruzione if corrente per fare "if not in p4port" senza perdere la logica corrente – user1795998