Calculating average time

Skip Montanaro skip at pobox.com
Thu Jul 7 22:46:13 CEST 2005


    greg> 1. Is there a better time function to use?

For this particular scenario I think time.time() is probably what you want:

    cumulative = 0.0
    n = 0
    for link in links:
        t = time.time()
        ie.Navigate(link)
        cumulative += time.time() - t
        n += 1

    print "average page load time:", cumulative/n, "seconds"

Skip



More information about the Python-list mailing list