On Dec 23, 4:46 am, Sengly <[email protected]> wrote: > Hello all, > > I would like to calculate a string expression to a float. For example, > I have ('12/5') and I want 2.4 as a result. I tried to use eval but it > only gives me 2 instead of 2.5 > > Help!!! > > Regards, > > Sengly
>>> float('12')/float('5')
2.3999999999999999
>>> print float('12')/float('5')
2.4
>>> float(12/5)
2.0
>>> print float(12/5)
2.0
--
http://mail.python.org/mailman/listinfo/python-list
