cast to double python code example
Example 1: cast string to double python
x = "2342.34"
float(x) #2342.3400000000001
Example 2: string to float python
# Use the function float() to turn a string into a float
string = '123.456'
number = float(string)
number
# Output:
# 123.456