Categories
Python Answers

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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *