Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

PREVIOUS NEXT
Code Example
Python :: WebDriverWait 
Python :: numpy save multiple arrays 
Python :: pandas crosstab 
Python :: python remove suffix 
Python :: generate random token or id in django 
Python :: can you release a python program to an exe file 
Python :: install fasttext python 
Python :: plot a circle in python using equation of a circle 
Python :: 3d array python numpy 
Python :: matplotlib figure cut off 
Python :: binary to decimal conversion python 
Python :: flask remove file after send_file 
Python :: python merge pdf files into one 
Python :: flask get data from html form 
Python :: python nonlocal 
Python :: strftime 
Python :: how to convert boolean type list to integer 
Python :: clean column names pandas 
Python :: python list transpose 
Python :: read file contents python 
Python :: check python version windows 
Python :: dt.weekday_name 
Python :: how to give bar plot groupby python different colors 
Python :: python move cursor to previous line 
Python :: rest_auth pip 
Python :: max pooling in cnn 
Python :: how to add item to a list python 
Python :: get a list as input from user 
Python :: beautifulsoup find get value 
Python :: fibonacci series list comphrehension in python 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =