Hi,

I have to write a code in python to read a matrix from a text file and
for that i am using following code. But it gives an error saying
"NameError: name 'split' is not defined". Can anyone help me with this.
-------------------------------------------------
#!/usr/bin/python
import numpy
file = open('matrix.txt', 'r')

count =  0
ra = numpy.random
A = ra.standard_normal((4,4))
while 1:
    lineStr = file.readline()
    if not(lineStr):
        break

    count = count + 1
    row=split(lineStr)
    A[count,:]=row

matrix.close()
-----------------------------------------------------
Also, i want to initialize the matrix A by zeros, but using A=zeros([4,
4]) was giving a similar error "NameError: name 'zeros' is not
defined". 

Thank you
Amit

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to