Re: [Numpy-discussion] Saving and loading a structured array from a TEXT file

2012-01-23 Thread Derek Homeier
On 23 Jan 2012, at 22:07, Derek Homeier wrote: >> In [4]: r = np.ones(3,dtype=[('name', '|S5'), ('foo', '> '> >> In [5]: r.tofile('toto.txt',sep='\n') >> >> bash-4.2$ cat toto.txt >> ('1', 1, 1.0) >> ('1', 1, 1.0) >> ('1', 1, 1.0) >> > > cnv = {0: lambda s: s.lstrip('('), -1: lambda s: s.rstr

Re: [Numpy-discussion] Saving and loading a structured array from a TEXT file

2012-01-23 Thread Derek Homeier
On 23 Jan 2012, at 21:15, Emmanuel Mayssat wrote: > Is there a way to save a structured array in a text file? > My problem is not so much in the saving procedure, but rather in the > 'reloading' procedure. > See below > > > In [3]: import numpy as np > > In [4]: r = np.ones(3,dtype=[('name', '|

[Numpy-discussion] Saving and loading a structured array from a TEXT file

2012-01-23 Thread Emmanuel Mayssat
Is there a way to save a structured array in a text file? My problem is not so much in the saving procedure, but rather in the 'reloading' procedure. See below In [3]: import numpy as np In [4]: r = np.ones(3,dtype=[('name', '|S5'), ('foo', ' in () > 1 r2 = np.fromfile('toto.txt',sep='\n',dt