python round四舍五入的问题

python 里3.15  round(3.15,1)=3.1

print(round(3.15,1))
decimal.getcontext().rounding=decimal.ROUND_HALF_UP
b=decimal.Decimal('3.15',decimal.getcontext())
print(round(b,1))

原文地址:https://www.cnblogs.com/mojiemeizi/p/9681516.html