views:

9157

answers:

2

I would like to know how to convert a string containing digits to a double.

+14  A: 
>>> x = "2342.34"
>>> float(x)
2342.3400000000001

There you go. Use float (which is almost always a C double).

Mongoose
Or, more specifically, Python floats are C doubles.
Aaron Gallagher
A: 

That is not a python double. A python double has unlimited capacity.

Alex