>>> x = "2342.34"
>>> float(x)
2342.3400000000001
There you go. Use float (which behaves like and has the same precision as a C,C++, or Java double).
Answer from Mongoose on Stack Overflow Top answer 1 of 3
401
>>> x = "2342.34"
>>> float(x)
2342.3400000000001
There you go. Use float (which behaves like and has the same precision as a C,C++, or Java double).
2 of 3
57
The decimal operator might be more in line with what you are looking for:
>>> from decimal import Decimal
>>> x = "234243.434"
>>> print Decimal(x)
234243.434
GeeksforGeeks
geeksforgeeks.org › python › convert-string-to-double-in-python3
Convert String to Double in Python3 - GeeksforGeeks
October 8, 2021 - Python3 · str1 = "9.02" print("This is the initial string: " + str1) # Converting to double str2 = float(str1) print("The conversion of string to double is", str2) str2 = str2+1 print("The converted string to double is incremented by 1:", str2) Output: This is the initial string: 9.02 The conversion of string to double is 9.02 The converted string to double is incremented by 1: 10.02 ·
[Solved] How do you convert string into double?
I was trying to do the "Area of a circle" test and I'm having trouble converting string to double. More on sololearn.com
How I convert float to string in this case?
You shouldn't call your variable sum, as that's a name of a built in function: https://docs.python.org/3/library/functions.html#sum Your problem however, stems from trying to add a string to a float. Could you please tell me, what is Adam + 5? Well, you can't, because it makes no mathematical sense. You didn't save the string representation str(sum), so sum never changed to a string What your research found is f-strings and they are very easy to use. Try: print(f"the sum of the values is {sum}") Simply, put an f before a string starts, then any string that you want goes between " and ", while any variables or other values go between { and } More on reddit.com
Python string to float conversion
I don't know what you mean: >>> a = '1721244344.700249000' >>> float(a) 1721244344.700249 These are all the decimal places. Trailing zeros will always be omitted as they are irrelevant. If you want to show them, do so when you output the value: >>> print(a.format("{:.9}")) 1721244344.700249000 More on reddit.com
Help with turning the output time into double digits instead of single digit
There’s also format and the % operator More on reddit.com
03:58
python converting a string into a float | daily dose of stack ...
08:37
Python Program #58 - Convert a String to a Float or Int in Python ...
08:15
Using Exception Handling to Convert Strings to Floats in Python ...
00:55
Convert string to float in python | String to float datatype ...
10:33
How To Convert String To Float In Python - YouTube
09:01
How to convert a string to a float - Python Convert String to Float ...
Codemia
codemia.io › home › knowledge hub › how do i convert a string to a double in python?
How do I convert a string to a double in Python? | Codemia
September 24, 2025 - In Python, the usual equivalent of a double-precision number is float. Converting a string is therefore usually just float(text), but real code also has to think about invalid input, formatting noise, and whether binary floating point is appropriate for the domain.
Finxter
blog.finxter.com › how-to-convert-a-string-to-a-double-in-python
How to Convert a String to a Double in Python? – Be on the Right Side of Change
August 6, 2021 - Python doesn’t provide an explicit “double” data type. However, it provides the float type that behaves the same and has the same precision as doubles in C, C++, or Java. To convert a string with digits to a “double” (i.e., “float”) in Python, use the built-in function float(string).
Python Guides
pythonguides.com › convert-a-string-to-a-double-in-python
How To Convert Python String To Double?
April 2, 2025 - The most simple approach to convert a string to a double is using Python’s built-in float() function.
pythontutorials
pythontutorials.net › blog › how-do-i-convert-a-string-to-a-double-in-python
How to Convert a String to a Double in Python: A Step-by-Step Guide — pythontutorials.net
But wait—Python doesn’t have a separate double type like some other languages (e.g., Java or C++). Instead, Python uses float, which is a double-precision floating-point number (64-bit), equivalent to a "double" in other languages. So, when we talk about converting a string to a "double" in Python, we’re really converting it to a float type.
Its Linux FOSS
itslinuxfoss.com › home › python › how to convert string to double in python?
How to Convert String to Double in Python? – Its Linux FOSS
January 3, 2023 - To convert the string to double in Python, the “float()” function and the “Decimal()” function of the “decimal” module are used.
Top answer 1 of 5
3
Jimmy Tyrrell ,
please link your complete code here, we also need to see the dictionary
if this is a sololearn exercise we need to know the tutorial name and / or exercise name / number
2 of 5
3
Jimmy Tyrrell ,
using your first code sample, we can do it like this:
...
searchQuery = input()
#print(sampleDict.get(searchQuery, "Not found")[1])
#(1) this version works well if key is found, but returns only "o" if key is not found
print(sampleDict.get(searchQuery, ["","Not found"])[1])
#(2) modifying the output if key is not found should do the job
Esri Community
community.esri.com › t5 › modelbuilder-questions › converting-string-values-into-doubles › td-p › 709061
Solved: Converting String-Values into doubles - Esri Community
August 10, 2017 - For the good of the thread, here's a fancier one-line Calculate Value expression (no code block needed) to convert a string to a float value. I am using a Python dictonary data structure to do this.
Sololearn
sololearn.com › en › Discuss › 2870653 › solved-how-do-you-convert-string-into-double
[Solved] How do you convert string into double?
Sololearn is the world's largest community of people learning to code. With over 25 programming courses, choose from thousands of topics to learn how to code, brush up your programming knowledge, upskill your technical ability, or stay informed about the latest trends.
W3Schools
w3schools.com › python › python_casting.asp
Python Casting
Python is an object-orientated language, and as such it uses classes to define data types, including its primitive types. Casting in python is therefore done using constructor functions: int() - constructs an integer number from an integer literal, a float literal (by removing all decimals), or a string literal (providing the string represents a whole number)
GeeksforGeeks
geeksforgeeks.org › convert-string-to-float-in-python
Convert String to Float in Python - GeeksforGeeks
April 26, 2025 - So conversion of string to double is the same as the conversion of string to float This can be implemented in these two ways 1) Using float() method Python3 str1 = "9.02 ... Python defines type conversion functions to directly convert one data ...