[SciPy-User] Can loadtxt do this: complex file format

Daπid davidmenhur@gmail....
Mon Nov 26 04:59:44 CST 2012


On Mon, Nov 26, 2012 at 10:16 AM, François Beaubert
<francois.beaubert@univ-valenciennes.fr> wrote:

converters = {2: lambda s: float(s[1:)), 4: lambda s: float(s[:-1)),
5: lambda s: float(s[1:)), 7: lambda s: float(s[:-1)))
time,Ux1,Uy1,Uz1,Ux2,Uy2,Uz2 = loadtxt(filename, comments='#',
skiprows = 4, delimiter=None, usecols=(0,1,2,3,4,5,6), unpack=True,
converters = converters)

I have added skiprows to jump over the first few lines, and the
converters = converters to get rid off the " ( ". I insist, I haven't
tested my converters function, so it may be wrong, but it should be
easy to fix.


David.


More information about the SciPy-User mailing list