在写os作业时,运行代码x86.py代码时发现以下报错:
这个报错的意思是
AttributeError:模块“time”没有属性“clock”
解决方法:
根据报错代码位置,line975将修改time.clock 为:time.perf_counter()
结果:
可以看到运行成功了。
原因追溯:
time模块在Python 3.x版本中已经将clock()方法废弃。应该使用time.perf_counter()或者time.process_time()方法来代替clock()