rajinikanth rajinikanth - 1 year ago 94
Python Question

Total time for executing the code--python

I want to calculate the total time taken to execute the code and I want to stop executing code for some time.Is it possible?.If so anyone help me out how to approach this problem.

Answer Source

To get execution time in python Simple way is :

import time
start_time = time.time()
print("--- %s seconds ---" % (time.time() - start_time))

This assumes that your program takes at least a tenth of second to run.

Prints :

--- 0.764891862869 seconds ---

For stopping Execution for a while you can Use:

import time

This will wait for 6 second before executing next line of code

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download