调用time库就行,网上常用的time.time()和time.clock()都很拉跨,后者还被高版本python放弃了。
目前推荐使用time.process_time()
import time
start = time.process_time()
main()
end = time.process_time()-start
print('run time:%fs'%end)
调用time库就行,网上常用的time.time()和time.clock()都很拉跨,后者还被高版本python放弃了。
目前推荐使用time.process_time()
import time
start = time.process_time()
main()
end = time.process_time()-start
print('run time:%fs'%end)