>>> a = 1
>>> b = 3
>>> print(a/b)
0
>>> #方法一:
... print(round(a/b,2))
0.0
>>> #方法二:
... print(format(float(a)/float(b),'.2f'))
0.33
>>> #方法三:
... print ('%.2f' %(a/b))
0.00
>>>

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
相关资源
相似解决方案