Answers for "python string format digits after decimal"

4

python format only 1 decimal place

>>> "{0:0.1f}".format(45.34531)
'45.3'
Posted by: Guest on August-02-2020
0

format string to 2 decimal places python

num = 123.4567
print(round(num, 2))
#2 is the number of decimal digits (after the .)
Posted by: Guest on November-08-2021

Code answers related to "python string format digits after decimal"

Python Answers by Framework

Browse Popular Code Answers by Language