python program to read a matrix from a given file
<p>i have a text file which contains matrix of N * M dimensions ,</p>

<p>for example the input.txt file contains the following </p>

<pre><code>0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
0,0,0,0,0,0,0,0,0,0
0,0,2,1,0,2,0,0,0,0
0,0,2,1,1,2,2,0,0,1
0,0,1,2,2,1,1,0,0,2
1,0,1,1,1,2,1,0,2,1
</code></pre>

<p>I need to write python script where in i can import the matrix .</p>

<p>My current python script is</p>

<pre><code>f = open ( 'input.txt' , 'r')
l = []
l = [ line.split() for line in f]
print l
</code></pre>

<p>the output list comes like this </p>

<pre><code>[['0,0,0,0,0,0,0,0,0,0'], ['0,0,0,0,0,0,0,0,0,0'], ['0,0,0,0,0,0,0,0,0,0'],  
['0,0,0,0,0,0,0,0,0,0'], ['0,0,0,0,0,0,0,0,0,0'], ['0,0,0,0,0,0,0,0,0,0'],  
['0,0,2,1,0,2,0,0,0,0'], ['0,0,2,1,1,2,2,0,0,1'], ['0,0,1,2,2,1,1,0,0,2'],  
['1,0,1,1,1,2,1,0,2,1']]
</code></pre>

<p>i need to fetch the values in int form . If i try to type cast , it throws errors. </p>
