标签: python rounding
这是我的代码:
foo = 1.345 print("%.2f" % foo) foo = 1.346 print("%.2f" % foo)
我预计在两种情况下都会获得1.35,但第一种情况下会返回1.34。为什么呢?