F
F
First Second2021-08-08 18:15:33
Python
First Second, 2021-08-08 18:15:33

How to convert long float to string?

Hello. Faced the problem of converting a long float number.

price = 0.000001458
res = price + price * 0.2
print(res)

>>>1.7496000000000002e-06


How to force the code to produce a real number without e-06??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-08-08
@vmolostvov

print(f'Number: {res:.6f}') Will print
you a number with 6 decimal places.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question