dcsimg
 

Submitted by: Srinath M S(srinath_ms@yahoo.com)

Tuesday Sep 26th 2017 by Srinath M S

Language: Web, Expertise: Intermediate - Learn to use the time module and time function to capture compute time in Python.

Import the time module and call the time function. The units are in Seconds.

See below for an easy example.

import time
startTime= time.time()
"time consuming stuff
"time consuming stuff
"time consuming stuff
endTime = time.time()
print(endTime - startTime)
Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved