用充分的技巧来编写 Python 中的投票功能

2024-04-25 09:34:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我编写了一个轮询函数来检查reg_result变量的值120秒。

reg_result = 0
while_timeout = time.time() + 120
while reg_result is not "REGISTERED" and time.time() < while_timeout:
    reg_result = LeshanObj.validate_reg_time(parameter_1)

还有其他更好的方法来编写轮询方法吗?

不使用while循环是否可能?


Tags: and方法函数parametertimeistimeoutnot