gett error message: "TypeError: 'int' object is not callable"
bruno.42.desthuilliers at websiteburo.invalid
Thu Jul 9 16:24:19 CEST 2009
Nick a écrit :
> I've seen a lot of posts on this problem, but none seems to help.
> Here is the code:
> file = open(prefix1)
shadows the builtin 'file' type.
> text = file.readlines()
> len = len(text)
shadows the builtin 'len' function.
> fields = text.split()
> num_rows = int(fields)
> num_cols = int(fields)
> U1_matrix = 
> print fields
> print repr(fields)
> print len(fields)
And here's your problem - 'len' is now bound to the result of the
previous call to len(text).
Hint : Python's functions, classes and modules are objects too, and
don't live in a distinct namespace. So _don't_ use builtin's types /
functions / etc names as identifiers.
More information about the Python-list