如何在python中舍入到两位数来计时

时间:2017-08-29 23:40:39

标签: python python-3.x rounding

我正在编写这个程序,我希望将打印出来的时间缩短到十位。

from timeit import default_timer
        start= default_timer()
#This is where i have a bunch of other code that isn't relavant
duration = default_timer()-start
print (duration)

我在打印之前尝试使用圆形(持续时间,2)并且没有用。我只是不知道如何围绕它。这可能是一个简单的答案,但我无法弄清楚。谢谢!

1 个答案:

答案 0 :(得分:-2)

this question的重复。这是该链接中提供的一个答案:

ios