title: Creating n*n matrix from text file contains list of lists in python
body: <p>I have a text file contains a list (#lines = 1137) of vectors (all are equal size= 1137), am trying to convert this list to 1137*1137 matrix. I created an empty matrix using numpy. But the problem after when I read the file using the following code, the vectors are treated as a sequence of characters, not as a vector or array </p>
  
  <pre><code>myMtrx = np.empty((1137,1137))
  f = open("text.txt", "r")
  for vector in f:
      print len(vector) 
      arrayF.append(vector.rstrip())
  </code></pre>
  
  <p>I recognized that by printing our the length of each vector, which is computed based on number of digits not elements in that vector. The vector in the text file looks like </p>
  
  <pre><code>[99.25, 14.74, 26.12, 20.91, 37.14, 79.03, 17.68,  28.4, ...., 0]
  </code></pre>
  
  <p>so when I print <code>print arrayF[0][0]</code> I receive <code>[</code>, where I need the output to be the 1st element of the 1st vector, which is 99.25.  </p>
  
  <p>I tried several ways using numpy, and writing the text file to CSV but nothing works, can you please assist me to solve this issue. You can access the text file through the following link give you an idea about its structure.
  <a href="https://www.dropbox.com/s/8ixib218ntw8ve0/text.txt?dl=0" rel="nofollow noreferrer">text.txt</a></p>