make a full matrix output in python
Question: I have a matrix with 236 x 97 dimension. When I print the matrix in Python its
output isn't complete, having `.......` in the middle of matrix.

I tried to write the matrix to a test file, but the result is exactly same. I
can't post the screenshot because my reputation is not enough, and won't
appear correctly if I choose another markup option. Can anyone solve this?

* * *
    
    
     def build(self):
        self.keys = [k for k in self.wdict.keys() if len(self.wdict[k]) > 1]
        self.keys.sort()
        self.A = zeros([len(self.keys), self.dcount])
        for i, k in enumerate(self.keys):
            for d in self.wdict[k]:
                self.A[i,d] += 1
    
     def printA(self):
        outprint = open('outputprint.txt','w')
        print 'Here is the weighted matrix'
        print self.A
        outprint.write('%s' % self.A)
        outprint.close()
        print self.A.shape
    


Answer: The problem is that you're specifically saving the `str` representation to a
file with this line:

> `outprint.write('%s' % self.A)`

Which explicitly casts it to a string (`%s`) --- generating the abridged
version you're seeing.

There are lots of ways to write the entire matrix to output, one easy option
would be to use
[numpy.savetxt](http://docs.scipy.org/doc/numpy/reference/generated/numpy.savetxt.html),
for example:

    
    
    import numpy
    numpy.savetxt('outputprint.txt', self.A)
    

