Home computickets Converting the exponential notation of a number to the usual one

Converting the exponential notation of a number to the usual one

Author

Date

Category

There is such a construction

return 'Current price:' + str (resBTC_obj ['token'] ['last']) + 'per 1 token '

Which returns the price, but it returns the price in exopential form, how to get rid of this?


Answer 1, authority 100%

Try this, where .2f is 2 decimal places:

'Current price:' + '{: .2f}'. format (resBTC_obj ['token'] [' last ']) +' per 1 token '

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions