Languages
[Edit]
EN

Python - convert string to double

0 points
Created by:
Antonina-Trejo
327

Unfortunately, there are no doubles in Python. You can use float that behaves like a double as an alternative solution.

Quick solution:

number = "1.234"
result = float(number)

print(type(result))  # <class 'float'>

or:

from decimal import Decimal

number = "1.234"
result = Decimal(number)

print(type(result))  # <class 'decimal.Decimal'>

See also

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Cross technology - convert string to double

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join