Menu Close

How to suppress scientific notation when printing float values with Python?

Sometimes, we want to suppress scientific notation when printing float values with Python.

In this article, we’ll look at how to suppress scientific notation when printing float values with Python.

How to suppress scientific notation when printing float values with Python?

To suppress scientific notation when printing float values with Python, we call the format method.

For instance, we write

a = -7.1855143557448603e-20
'{:f}'.format(a)

to call format on string '{:f}' to return a string that has all the digits in the number a in it.

Conclusion

To suppress scientific notation when printing float values with Python, we call the format method.

Posted in Python, Python Answers