[Tutor] writing files using modules and functions
Rufino Beniga
rbeniga04 at gmail.com
Tue Nov 13 07:43:20 CET 2012
def MatInv(arr,file):
f = open('file.txt','w')
f.write(arr)
f.close()
So I'm trying to write a module that will take a matrix (arr) and write it
to a text file.
The above module is called MatrixIO.py
#first I import it
import MatrixIO
#Then i call the function MatInv with matrix(a) and file name (doc) as the
arguments
MatInv(a,doc)
It creates a file called txt and it shows only boxes. What am I doing wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121112/caa3f3e7/attachment.html>
More information about the Tutor
mailing list