Converting a string to integer/float

James Henderson james at
Thu Jan 22 12:37:19 CET 2004

On Thursday 22 January 2004 3:43 am, Ikot wrote:
> Hello,
> I am stuck with a problem, might be very trivial, to ask here, but
> dont find a way out. I read a string like 12345.678 from a text file,
> which will be string for me, but how do I convert it into a float for
> my use ?
> Thanks
> Ikot

float is a builtin type that can be constructed from a string:

>>> float('12345.678')

You'd probably find it helpful to work your way through:

James Henderson, Logical Progression Ltd.

More information about the Python-list mailing list