← 返回列表

Python3 时间time模块 Clock 方法

Python3 时间time模块 Clock 方法 #!/usr/bin/python3 import time def procedure(): time.sleep(2.5) # measure process time t0 = time.clock() procedure() print (time.clock() - t0, "seconds process time") # measure wall time t0 = time.time() procedure() print (time.time() - t0, "seconds wall time")

Python3 时间time模块 Clock 方法

#!/usr/bin/python3
import time

def procedure():
   time.sleep(2.5)

# measure process time
t0 = time.clock()
procedure()
print (time.clock() - t0, "seconds process time")

# measure wall time
t0 = time.time()
procedure()
print (time.time() - t0, "seconds wall time")

打开资源 ↗

交流与评论