-3

How do I look for a non-zero value in “things” within python and create flags.

  • If there not is a non-zero value then I have to create a timeout flag.

  • If there is a Non-zero then I need to clear the timeout flag

  • return things

    def look_things(self, size)
    
         things = self.read(size)
    
         return things
    
azro
  • 53,056
  • 7
  • 34
  • 70

1 Answers1

0

Use the len() function to test the length of things.

if len(things) > 0:
    self.clear_timeout_flag()
else:
    self.set_timeout_flag()
Barmar
  • 741,623
  • 53
  • 500
  • 612