Format it to 6 decimal places:

format(value, '.6f')

Demo:

>>> format(2.0, '.6f')
'2.000000'

The format() function turns values to strings following the formatting instructions given.

Answer from Martijn Pieters on Stack Overflow
๐ŸŒ
Bobby Hadz
bobbyhadz.com โ€บ blog โ€บ python-add-zeros-after-decimal
Add zeros to a Float after the Decimal in Python | bobbyhadz
Use the `format()` function to add zeros to a float after the decimal, e.g. `result = format(my_float, '.3f')`.
Discussions

keep trailing 0's in floats?
The Decimal library is great for this. This helps you avoid floating point arithmetic errors too. More on reddit.com
๐ŸŒ r/learnpython
6
2
July 20, 2017
python - Adding zeros after the decimal point - Stack Overflow
I have a certain dictionary key and its values that I wish to print out in a string in a certain fashion. The key and its values is: 'HUF': (315.89, 307.09) and the desired output is: HUF....315... More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - How to add zeros after the decimal to make 2 digits after decimal in ipython and pyspark - Stack Overflow
Now some of the numbers in this ... any decimal like 5 or 23. What I want is to have all the numbers two digits after decimal. If they do not have two digits then an ending 0 should be added like for above 9.1 should become 9.10 and 5 should become 5.00.... More on stackoverflow.com
๐ŸŒ stackoverflow.com
format - python padding decimals with zeros - Stack Overflow
56 Add zeros to a float after the decimal point in Python More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
IQCode
iqcode.com โ€บ code โ€บ python โ€บ how-to-add-extra-zeros-after-decimal-in-python
how to add extra zeros after decimal in python Code Example
October 6, 2021 - adding zero before a number in python how to add leading zeros in pythyon python print leading zeros python add zero before single digits how to prevent python from giving extra zero decimal values python add zero after decimal add zero before number in string python add point zero in value python how to add zeros to decimal oin python leading zeros in integers python int leading zero python how to add 0 after decimal in python python add zeros after decimal python add leading 0 to number how to add extra zero in float python python add leading zeros to string string format python leading zero
๐ŸŒ
YouTube
youtube.com โ€บ speak with ujjwal
How to add zero at the end of a decimal number in Python ? - YouTube
How to add trailing zero at the end of a decimal number in Python format function in Python
Published: July 21, 2020
Views: 1K
Find elsewhere
๐ŸŒ
TopDealsNet
stlplaces.com โ€บ blog โ€บ how-to-add-zeros-after-a-decimal-in-python
How to Add Zeros After A Decimal In Python in 2026?
September 20, 2025 - If you want to add zeros beyond the current decimal places, you can simply increase the number within the curly braces. For example, "{:.4f}".format(number) would add two additional zeros after the decimal.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 32079394 โ€บ how-to-add-zeros-after-the-decimal-to-make-2-digits-after-decimal-in-ipython-and
python - How to add zeros after the decimal to make 2 digits after decimal in ipython and pyspark - Stack Overflow
Now some of the numbers in this list come out to have two digits after decimal like 10.17 but there are numbers which have less than two digits after decimal like 9.1 or some do not have any decimal like 5 or 23. What I want is to have all the numbers two digits after decimal. If they do not have two digits then an ending 0 should be added like for above 9.1 should become 9.10 and 5 should become 5.00.
๐ŸŒ
CodingTechRoom
codingtechroom.com โ€บ question โ€บ -add-zeros-after-decimal-python
How to Add N Number of Zeros After a Decimal in Python - CodingTechRoom
In Python, you can format float values to add a specific number of zeros after the decimal point by using formatted string literals or the format method.
๐ŸŒ
Machinelearninghelp
machinelearninghelp.org โ€บ programming-for-machine-learning โ€บ how-to-add-extra-zeros-after-decimal-in-python
Adding Extra Zeros after Decimal in Python for Machine Learning Applications
This technique is particularly ... In Python, adding extra zeros after a decimal number involves rounding it to a specified precision using the round() function or manipulating its string representation....
๐ŸŒ
Kaggle
kaggle.com โ€บ questions-and-answers โ€บ 388405
[Python] Adding trailing zeros to every value in a column with floats? | Kaggle
Hi fellow Kagglers! I have an issue I can't quite fix myself. I have a column in a dataframe with inconsistent decimals which needs fixing. All values need 2...
๐ŸŒ
Iditect
iditect.com โ€บ faq โ€บ python โ€บ add-zeros-to-a-float-after-the-decimal-point-in-python.html
Add zeros to a float after the decimal point in Python
If you want to add zeros to a floating-point number in Python after the decimal point to achieve a certain number of decimal places, you can use string formatting or the round function.
๐ŸŒ
Tutorial Reference
tutorialreference.com โ€บ python โ€บ examples โ€บ faq โ€บ python-how-to-add-trailing-zeros-after-decimal-in-float
How to Format Floats with Trailing Zeros in Python | Tutorial Reference
It's crucial to understand that Python's float type does not inherently store trailing zeros after the decimal point. The trailing zeros are added only during formatting for display:
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python-add-trailing-zeros-to-string
Add trailing Zeros to string-Python | GeeksforGeeks
April 5, 2025 - Letโ€™s explore some efficient approaches to achieve this in Python. This is the most efficient way to add trailing zeros. By multiplying the string '0' with N, we get a string of N zeros.
๐ŸŒ
Machinelearninghelp
machinelearninghelp.org โ€บ programming-for-machine-learning โ€บ how-to-add-a-zero-after-a-float-in-python
Precision in Numerical Computation
This can be mathematically represented by considering the number of significant digits or decimal places in a given float value. Adding zeros after a float in Python has numerous applications, including:
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ stable โ€บ reference โ€บ generated โ€บ numpy.format_float_positional.html
numpy.format_float_positional โ€” NumPy v2.5 Manual
If True, the cutoffs of precision and min_digits refer to the total number of digits after the decimal point, including leading zeros.