Format a number containing a decimal point with leading zeroes
-
29-10-2019 - |
Question
I want to format a number with a decimal point in it with leading zeros.
This
>>> '3.3'.zfill(5)
003.3
considers all the digits and even the decimal point. Is there a function in python that considers only the whole part?
I only need to format simple numbers with no more than five decimal places. Also, using %5f
seems to consider trailing instead of leading zeros.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow