Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python: for and if loop
#4
@deanhystad : I think that you are right about my problem with the binary2 function. Its the loop which causes problem.

How can I resolve this problem plz ?

Func_code contains certainely 3 and 1 values. He is its code:

    
   def func_code(s):
    r = []
    for p in s:
        if p.haslayer('ModbusADURequest'):
            try:
                if p['ModbusADURequest'][1].funcCode == 3:
                    r.append(3)
                elif p['ModbusADURequest'][1].funcCode == 1:
                    r.append(1)
            except AttributeError:
                pass
Reply


Messages In This Thread
Python: for and if loop - by salwa17 - Jun-19-2020, 12:40 PM
RE: Python: for and if loop - by deanhystad - Jun-19-2020, 01:07 PM
RE: Python: for and if loop - by Yoriz - Jun-19-2020, 02:32 PM
RE: Python: for and if loop - by salwa17 - Jun-20-2020, 03:15 PM
RE: Python: for and if loop - by deanhystad - Jun-22-2020, 01:17 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020