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

Nick nleioatt at gmail.com
Thu Jul 9 09:42:06 EDT 2009


I've seen a lot of posts on this problem, but none seems to help.
Here is the code:
/code

file = open(prefix1)
text = file.readlines()
len = len(text)
fields = text[1].split()
num_rows = int(fields[1])
num_cols = int(fields[2])

U1_matrix = []

print fields
print repr(fields)
print len(fields)

for line in text[2: num_rows+2]:
    fields = line.split()
#    print "fields", fields, line
    for i in range(len(fields)):
        fields[i] = float(fields[i])
    U1_matrix.append(fields)

/*code

prefix is a space/line delimited ascii file that represents a 2D
matrix.  i'm trying to read in 2 matrices from different files, strip
away the header stuff and then take the dot product of the 2
matrices.  any help is much appreciated.

thanks,
nick



More information about the Python-list mailing list