[Tutor] Converting from unicode to nonstring
Joel Goldstick
joel.goldstick at gmail.com
Thu Oct 14 21:27:01 CEST 2010
To take a string of comma separated integers and convert to a list of
floats:
>>> x = u'1,2,3,4'
>>> y = x.split(',')
>>> z = [float(f) for f in y]
>>> z
[1.0, 2.0, 3.0, 4.0]
>>>
--
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101014/3fe39bf5/attachment.html>
More information about the Tutor
mailing list