Read/write 2D data from/to file..?

Vasily Sulatskov redvasily at gmail.com
Sun Feb 11 23:04:11 EST 2007


On Feb 12, 6:47 am, "mech point" <srikanth.a... at gmail.com> wrote:
> I was able to read the data from file into a two dimensional array
> (lists)
>
> rows=[map(float,line.split())for line in file("data")]
>
> but How to write them back into the file.

Using matplotlib it will be:

import pylab
rows = pylab.load('src.dat')
pylab.save(rows, 'dst.dat')






More information about the Python-list mailing list