>>> a=123.3232
>>> math.modf(a)
(0.32319999999999993, 123.0)

小数位数较多,可以使用round

如:

>>> round(0.32319999999999993,4)
0.3232

 

相关文章: