[Baypiggies] Question about python read data table from a text file

Yiou Li liyiou at gmail.com
Wed Apr 6 00:32:10 CEST 2011


Hi all,

I have a text file with numerical data, like this:

data.txt

19  19  20  21  22  17  18  19  20  21  22  23  41  42  17  18  19  20
 21  42  45  18  19  20  21  22  20  21  22  23  42  43  17  19  20
21  22  23  24  40  41  42  43  44  45  46  47  16  17  18  19  20  21
 22  41  42  43  44  45  46  47  16  17  18  19  20  45  46  47  17
18  19  20  41  42  43  44  45  20  21  22  23  40  41  42  43  44  45
 46  47  48  20  21  22  23  24  40  41  42  43  44  45  46  47  48
17  18  19  ...

Could you please refer me a python function to read this file into the
memory as a data table?

the readlines() won't work because I need to access index the number
of ith row, jth column like x[i, j].

Best,
Leo


More information about the Baypiggies mailing list