reading data columns into separate lists

Viswa viswap at math.net
Sun May 2 04:48:59 EDT 2004


PythonGurus,

    I would like to read the ascii data from a file with many columns
into a list.  I want the type to be float.

data=open('dat1.dat','r')

lines=data.readlines()
print lines

Here, the data x1,x2,x3,x4 are separated
by tabs and end with new line.
1\t2\t3\t4\n
...
...

Is there a way to read the delimiter separated data
straightaway to a list of fixed type.

Thanks in advance,
viswa.



More information about the Python-list mailing list