【发布时间】:2018-05-15 22:06:36
【问题描述】:
我正在尝试计算排序功能需要多长时间,但我正在努力让time.process_time() 工作。
我目前的设置是:
start = time.process_time()
insertionsort(n)
end = time.process_time()
time = start-end
当我运行它时,我收到了这个错误:
'float' 对象没有属性 'process_time'
我该如何解决这个问题?我想使用time.process_time()。
【问题讨论】:
-
这就是问题所在。
time = start-end不要将变量命名为与标准库相同的名称。
标签: python python-3.x attributeerror