Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to set a timer in while loop python

start_time = time.time()
seconds = input("Enter: ")
seconds = int(seconds)

while True:
    current_time = time.time()
    elapsed_time = current_time - start_time

    if elapsed_time > seconds:
        print("Finished iterating in: " + str(int(elapsed_time))  + " seconds")
        break
Comment

PREVIOUS NEXT
Code Example
Python :: how to openn file dialog in tkinter 
Python :: pandas rename columns by position 
Python :: plotly express lineplot 
Python :: pandas get index of max value in column 
Python :: python scatter plot 
Python :: pandas groupby sum 
Python :: multiline input in python 
Python :: program to segregate positive and negative numbers in same list 
Python :: make python file executable linux 
Python :: dynamo python templete 
Python :: reverse keys and values in dictionary with zip python 
Python :: th2=cv2.adaptiveThreshold(img, 255 ,cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 11 # no of block size , 2 #c) 
Python :: anaconda create environment python version 
Python :: sort list of files by name python 
Python :: firefox selenium python 
Python :: taking hour information from time in pandas 
Python :: open an exe file using python 
Python :: pandas percentage change across multiple periods 
Python :: gonad 
Python :: numpy empty array 
Python :: how to split a string from the beginning to a specific character in python 
Python :: how to clear an array python 
Python :: combining 2 dataframes pandas 
Python :: classe statistique dataframe python 
Python :: get all paragraph tags beautifulsoup 
Python :: tqdm remove progress bar when done 
Python :: count missing values groupby 
Python :: keras auc without tf.metrics.auc 
Python :: divide a value by all values in a list 
Python :: how to convert a list into string with  
ADD CONTENT
Topic
Content
Source link
Name
3+8 =