need fast parser for comma/space delimited numbers

Les Schaffer godzilla at netmeg.net
Sun Mar 19 20:18:20 EST 2000


Michael Miller (aka TableIO):

> You can specify a string containing characters in comment lines.

unfortunately the files have no comment markers in them. so one
solution might be a create a file-like object and pass only the data
part of the file to TableIO.

> At the moment only whitespace separated fields are handled.  TableIO
> does handle whitespace plus commas, as in "0.0, 0.1, 0.2"

this is my case.


> A simple way to convert to integers would be do something like:
>  a, b, c = TableIO.readColumns( filename, string.letters )
>  a = Numeric.array( a.tolist(), Numeric.Int )

looks okay. actually i prefer b,c, ... to be rows in one dependent
variable array, but that could be arranged apres TableIO.

thanks Mike.

les schaffer



More information about the Python-list mailing list