How to make a timer while? I would like to execute a while, and do something, eg. a
print "hello"
run "hello" print for 1 hour for example.
How to make a timer while? I would like to execute a while, and do something, eg. a
print "hello"
run "hello" print for 1 hour for example.
You can do this:
import time
end_time = time.time() + 10
countTimer = 0
sleepTime = 0.500
while time.time() < end_time:
time.sleep(sleepTime)
countTimer += sleepTime
print('hello, ja passaram {} secs'.format(countTimer))
Change the 10 by 3600 for a 1 hour. You can remove sleep, but the program will become very heavy