[SciPy-user] read ascii data

Xavier Barthelemy xavier.barthelemy at cmla.ens-cachan.fr
Wed Dec 12 07:57:32 EST 2007


hi

in scipy, or numpy I can't recall, there's a function name io.read_array

data= 
io.read_array(filename,columns=(0,-1),lines=(0,-1),atype='thetypeyouwant')

columns and lines can be all like int his example, or you can just 
choose where to begin and where to end, or just a discrete list.

check the Doc, it is relatively well explained

Cheers
Xavier

Christoph Scheit a écrit :
> Hi All,
> 
> I have a file containing ascii data related to a block-structured grid.
> I could use readtxt, but I would like to have the possibility to read only
> a certain range of rows out of the file. Lets say I have ten blocks in my grid
> and each block 10 rows of data.
> So in one read I would like to read for instance line 30 to line 39
> I can use skip rows, but how can I limit the loadtxt to the upper limit?
> Is there something already available or do I have to do it on my own?
> 
> Thanks in advance,
> 
> Christoph
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user





More information about the SciPy-User mailing list