Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python stop while loop after time

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
 
PREVIOUS NEXT
Tagged: #python #stop #loop #time
ADD COMMENT
Topic
Name
9+1 =