[Tutor] writing ascii files with Numeric?

Bernard Lebel atyss4si at hotmail.com
Fri Jul 2 05:13:59 EDT 2004


Hi Jeff,

Just an idea: have you tried...
filehandle.write( str(Matrix) )


Cheers
Bernard


----- Original Message -----
From: Jeff Peery
To: tutor at python.org
Sent: Friday, July 02, 2004 12:40 AM
Subject: [Tutor] writing ascii files with Numeric?


Hello I am trying to write my Matrix to to a file in ASCII format. I created
the matrix using Numeric, the shape is 600x25. here is the code that
produces the error below:

    filehandle = file("MyFile.txt", 'w')
    filehandle.write(Matrix)
    filehandle.close()

TypeError: Non-character array cannot be interpreted as character buffer.

I am assuming this means that 'Matrix' must be a character string and not a
matrix. how would I go about converting an array of floats to a character
string so I can print this thing to a file? Or is there a better way to do
this? thanks!!!

Jeff



_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list