[Baypiggies] Question about python read data table from a text file
Tim Hatch
tim at timhatch.com
Wed Apr 6 00:46:57 CEST 2011
> the readlines() won't work because I need to access index the number
> of ith row, jth column like x[i, j].
I don't know if there's something stricter implied as "data table" (e.g.
numpy), but how about something like:
f = file('data.txt', 'rb')
x = [map(int, line.split()) for line in f]
f.close()
Then you can print x[i][j]
Tim
More information about the Baypiggies
mailing list