devxlogo

How to Capture Compute Time in Python

How 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 timestartTime= time.time()"time consuming stuff"time consuming stuff"time consuming stuffendTime = time.time()print(endTime - startTime)

devx-admin

Share the Post: