[SciPy-User] Padded data structure

Miguel de Val Borro miguel.deval@gmail....
Sun Feb 21 01:45:41 CST 2010

On Sat, Feb 20, 2010 at 10:55:59PM -0800, Christopher Barker wrote:
> > I would like to read padded output files from C structures that look
> > like this file: http://spec.jpl.nasa.gov/ftp/pub/catalog/catdir.cat 
> > The second row is a 13 character string that contains whitespaces.  I
> > have looked at the align option in dtype passed as a parameter to
> > loadtxt but could not make it work. 
> Since there is whitespace between all those columns, I don't think you 
> need align.  I suspect that a dtype something like:
> ('i4', 'S13', 'i4', 'f8', 'f8','f8','f8','f8','f8','f8', 'i2')

The problem is that the S13 string contains whitespaces, which is also
the separator between columns. Using this dtype I get the error:

ValueError: invalid literal for float(): v2,2v2,v


More information about the SciPy-User mailing list