Python time模块只clock在Python3.3废弃,在Python3.8中将被移除

Python time模块只clock在Python3.3废弃,在Python3.8中将被移除

在Python3.7中使用 time.clock()报警告

DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead

time.clock()

用以浮点数计算的秒数返回当前的CPU时间,用来衡量不同程序的耗时,比time.time()更有用

python3.3以后不被推荐使用,该方法依赖操作系统,建议使用per_counter(返回系统运行时间)或

process_time(返回进程运行时间)代替

猜你喜欢

转载自blog.csdn.net/ithongchou/article/details/85036924
今日推荐