Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python loop to run for certain amount of seconds

import time

seconds = 10 #The amount of seconds i want the loop to execute 

end_time = time.time() + seconds
while time.time() < end_time:
    print("This loop will execute for 10 seconds")
Comment

PREVIOUS NEXT
Code Example
Python :: sorting by second element 
Python :: python mysqldb 
Python :: python hello world web application 
Python :: convert image to black and white python 
Python :: delete specific indeces from numpy array 
Python :: dict.fromkeys with list as value 
Python :: pip clear download cache 
Python :: python update installed packages 
Python :: replace a string in a list 
Python :: add whitespaces between char python 
Python :: memory used by python program 
Python :: python textbox 
Python :: python list of integers 
Python :: how to sort dictionary in python by lambda 
Python :: password text in entry in tkinter 
Python :: python download for ubuntu 20.04 
Python :: django rest documentation 
Python :: calculate nth prime number python 
Python :: take array of string in python 
Python :: python print combinations of string 
Python :: datetime to unix timestamp milliseconds python 
Python :: noninspection access to protected member 
Python :: how to read tuples inside lists python 
Python :: seaborn correlation 
Python :: how to get decimal part of a double in python 
Python :: basemap python 
Python :: python selenium web scraping example 
Python :: add 2 set python 
Python :: fill null values with zero python 
Python :: how to use one with as statement to open two files python 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =