How to format a floating number to fixed width in Python

后端 未结 8 1067
长发绾君心
长发绾君心 2020-11-22 10:26

How do I format a floating number to a fixed width with the following requirements:

  1. Leading zero if n < 1
  2. Add trailing decimal zero(s) to fill up f
8条回答
提交回复
热议问题