On Thu, Sep 11, 2014 at 8:08 AM, Carmel O'Shannessy <carme...@umich.edu> wrote: > > 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]]
Hi Carmel, Do you intend to have a variable named "float.times" here on the left hand side of the assignment? If so, try a different name. What's happening is not variable assignment, but member assignment. The above statement is saying: Take the "float" type, and set its "times" attribute to the right hand side. And that's almost certainly not what you want to do. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor