. Advertisement .
..3..
. Advertisement .
..4..
How can I count seconds in python? I will be thankful for your solutions. I am trying to try with the following program
def countseconds(seconds):
startseconds = time.time()
time.clock()
elapsedtime = time.time() - startseconds
Here is a suggestion for youdef countseconds(seconds):
startseconds = time.time()
time.clock()
elapsedtime = 0
while elapsedtime < seconds:
elapsedtime = time.time() - startseconds
print "The loop cycle: %f, seconds count: %02d" % (time.clock() , elapsedtime)
time.sleep(1)
I’m guessing that this will work.