Carmel O'Shannessy wrote:

> 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'

Try

times[:2] = [float(s) for s in times[:2]]

PS: What did you expect

> float.times

to achieve?

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to