Thank you, it is so straightforward. On Fri, Jul 16, 2010 at 9:58 PM, Chris Rebert <clp2 at rebertia.com> wrote: > On Fri, Jul 16, 2010 at 5:52 PM, Jia Hu <hujia06 at 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20100716/f7ba4923/attachment-0001.html>