Is there an easy way in Python to wait until certain condition is true?

后端 未结 8 1352

I need to wait in a script until a certain number of conditions become true?

I know I can roll my own eventing using condition variables and friends, but I don\'t wa

8条回答
  •  佛祖请我去吃肉
    2020-12-23 21:12

    This worked for me

    direction = ''
        t = 0
        while direction == '' and t <= 1:
            sleep(0.1)
            t += 0.1
    

    This is for waiting for a signal while making sure time limit of 1 second

提交回复
热议问题