Writing 2d array in an ascci file
Jeremy Sanders
jeremy+complangpython at jeremysanders.net
Thu Sep 28 06:38:00 EDT 2006
charles.hebert at gmail.com wrote:
> I want to write an 2d array in an ascii file using numpy. There's the -
> tofile / fromfile - function but it doesn't work with nd array.
Is this good enough?
x = numpy.zeros( (10, 10) )
f = open('out.txt', 'w')
print >>f, str(x).replace('[',' ').replace(']', ' ')
f.close()
Jeremy
--
Jeremy Sanders
http://www.jeremysanders.net/
More information about the Python-list
mailing list