Answers for "time.sleep python for loop"

36

sleep function python

import time

print("Printed immediately.")
time.sleep(2.4)
print("Printed after 2.4 seconds.")
Posted by: Guest on November-23-2019
0

python time.sleep slow

from time import perf_counter as timer
import time
from ctypes import windll #new

timeBeginPeriod = windll.winmm.timeBeginPeriod #new
timeBeginPeriod(1) #new

start = timer()
for i in range(1000):
    print (i)
    time.sleep(0.001)

end = timer()
print ("Total time: ", end - start)
Posted by: Guest on September-05-2021

Python Answers by Framework

Browse Popular Code Answers by Language