<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
hi, <BR>
<BR>
i would like to know the time taken to execute a certain task in python. i used time.time and time.clock and i see the time taken is different? what is the right method to use? <BR>
<BR>
import time<BR>
def testtime(num):<BR> start=time.time()<BR> #print start<BR> for n in range(num):<BR> #print n<BR> print time.time()-start<BR> <BR>testtime(101) <BR>
<BR>start = time.clock()<BR>for x in range(101):<BR> y = x # do something<BR>end = time.clock()<BR>print "Time clock elapsed = ", end - start, "seconds"<BR>
<BR>
thanks<BR>
tcl<BR>
<BR>
<BR>                                            </body>
</html>