📜  python stop while loop after time - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:09.749000             🧑  作者: Mango

代码示例2
import time
timeout = time.time() + 60*5   # 5 minutes from now
while True:
    test = 0
    if test == 5 or time.time() > timeout:
        break
    test = test - 1