I'm novice in python. I do this code to say if funcCode is different from 5 and 6 do this : r.append(p['ModbusADURequest'][1].startAddr) else do r.append(p['ModbusADURequest'][1]. registerAddr) but I have an error " File "parserz.py", line 868 else: ^ SyntaxError: invalid syntax"
def reg_no_list(s):
r = []
for p in s:
if (p['ModbusADUResponse'][1].funcCode != int("0x06", 16)) and (p['ModbusADUResponse'][1].funcCode != int("0x05", 16)):
if p.haslayer('ModbusADURequest'):
try:
r.append(p['ModbusADURequest'][1].startAddr)
except AttributeError:
pass
return r
else:
r.append(p['ModbusADURequest'][1]. registerAddr)
except AttributeError:
pass
return r
Any help please ? Thanks in advance
Aucun commentaire:
Enregistrer un commentaire