Time A Script

Adam Pletcher adam at volition-inc.com
Wed Jul 11 18:14:18 EDT 2007


Try:

---
import time
start_time = time.time()
 
<code here>
 
run_time = time.time() - start_time
print 'Run time: %f seconds' % run_time
---

Also have a look at the timeit module for more timing functionality.

- Adam
 


________________________________

	From: python-list-bounces+adam=volition-inc.com at python.org
[mailto:python-list-bounces+adam=volition-inc.com at python.org] On Behalf
Of Robert Rawlins - Think Blue
	Sent: Tuesday, July 10, 2007 11:40 AM
	To: python-list at python.org
	Subject: Time A Script
	
	

	Hello Guys,

	 

	What's the best way to time how long it takes a script to run,
from top to bottom and then have it print that execution time at the
end?

	 

	Thanks guys,

	 

	Rob




More information about the Python-list mailing list