私はこのプログラムを書いています。私は十時間の場所に印刷される時間を丸めたいと思います。タイミングのためにPythonで2桁に丸める方法
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)
印刷する前にround(duration、2)を使用しようとしましたが、動作しませんでした。私はちょうどそれを丸める方法を本当に知らない。たぶん簡単な答えがありますが、私はそれを理解できませんでした。ありがとう!!
可能な複製(https://stackoverflow.com/questions/455612/limiting-floats-to-two-decimal-points:これは、そのリンクに提供される一つの答えです) – Arex