title: Matrix input from a text file(python 3)
body: <p>Im trying to find a way to be able to input a matrix from a text file;</p>
  
  <p>for example, a text file would contain</p>
  
  <pre><code>1 2 3
  4 5 6
  7 8 9
  </code></pre>
  
  <p>And it would make a matrix with those numbers and put it in matrix = [[1,2,3],[4,5,6],[7,8,9]]</p>
  
  <p>And then this has to be compatible with the way I print the matrix:</p>
  
  <pre><code> print('\n'.join([' '.join(map(str, row)) for row in matrix]))
  </code></pre>
  
  <p>So far,I tried this</p>
  
  <p>chemin = input('entrez le chemin du fichier') </p>
  
  <pre><code>        path = input('enter file location') 
  
          f = open ( path , 'r')
          matrix = [ map(int,line.split(','))) for line in f if line.strip() != "" ]
  </code></pre>
  
  <p>All it does is return me a map object and return an error when I try to print the matrix.</p>
  
  <p>What am I doing wrong? Matrix should contain the matrix read from the text file and not map object,and <strong>I dont want to use external library such as numpy</strong></p>
  
  <p>Thanks</p>