[Tutor] python qn

Carmel O'Shannessy carmelos at umich.edu
Thu Sep 11 17:08:04 CEST 2014


Hello,

times  =  ['50.319468', '50.319468', 't1']

I want to convert  [0:2] to floats.

I tried:

float.times = [float(i) for i in times[:2]]

but get the error msg:

TypeError: can't set attributes of built-in/extension type 'float'

Carmel
-- 

-- 
Carmel O'Shannessy, Assoc. Prof.
Department of Linguistics
University of Michigan
440 Lorch Hall
611 Tappan Street
Ann Arbor, MI, 48109-1220
Ph:   +1 734 764 0353
Fax: +1 734 936 3406
http://www-personal.umich.edu/~carmelos/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140911/7e6b373d/attachment-0001.html>


More information about the Tutor mailing list