gett error message: "TypeError: 'int' object is not callable"

Lie Ryan lie.1296 at gmail.com
Fri Jul 10 04:47:51 EDT 2009


Simon Forman wrote:
> On Thu, Jul 9, 2009 at 9:42 AM, Nick<nleioatt at gmail.com> wrote:
> <snip>
>>    fields = line.split()
>>    for i in range(len(fields)):
>>        fields[i] = float(fields[i])
> 
> 
> instead of the above code you could say:
> 
> fields = [float(n) for n in in line.split()]
> 
> Have fun getting back into python! :]  (A lot has changed in the last few years)

>>> fields = [float(n) for n in in line.split()]
  File "<stdin>", line 1
    fields = [float(n) for n in in line.split()]
                                 ^
SyntaxError: invalid syntax

s/in in/in/



More information about the Python-list mailing list