From: Chris Rebert on
On Fri, Jul 16, 2010 at 5:52 PM, Jia Hu <hujia06(a)gmail.com> wrote:
> Hello:
>
> If I want to calculate the runtime of a section of a program. How can I do
> it?

Taking you extremely literally:
from time import time
start = time()
run_section_here()
end = time()
runtime = end-start

Assuming you're doing this in order to optimize:
http://docs.python.org/library/profile.html
Or in particularly simple cases:
http://docs.python.org/library/timeit.html

Cheers,
Chris
--
http://blog.rebertia.com