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

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

如:

>>> round(0.32319999999999993,4)
0.3232

 

相关文章:

  • 2021-12-11
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
相关资源
相似解决方案