x = 50000011
s = '${:1.1f}M'.format(x*1e-6)
print(s)
s = '${:1.0f}K'.format(x * 1e-3)
print(s)
s = '${:.3f}K'.format(x * 1e-3)
print(s)
s = '%.3f' % (x*1e-3)
print(s)
$50.0M
$50000K
$50000.011K
50000.011

 

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-19
  • 2022-01-07
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2021-05-28
相关资源
相似解决方案