str to float (rounded)

Nader n.emami at gmail.com
Tue Jun 10 10:29:06 EDT 2008


Hello,

I have a list of tuple with strin elements. These elements are number,
but they are save as string. Now I will change the string to number
which will be rounded. An example will make it more clear.

t = [('35.757', '-0.239'), ('33.332', '-2.707'), ('33.640', '-2.423')]

And I will have the next list:

t = [(35.76, -2.24), (33.33, -2.71), (33.64, -2.42)]

The elements of tuple are not more as string.

Would somebody tell me how I can do that?

Regards,
Nader




More information about the Python-list mailing list