
Dec. 12, 2000
12:03 p.m.
You have many options: I frequently use Konrad Hinsen's "Scientific" package (http://dirac.cnrs-orleans.fr/programs/scientific.html). It make importing files from user input or other packages like matlab easy and supports several file formats. The simpliest is a basic white-space-delimitted text file if you have a text file "arrayfile.txt" that looks like this: # arrayfile.txt (lines beginning with '#' are ignored) 1 2 3 4 5 6 6 8 9 You can fire up python and read in your matrix like this:
from Scientific.IO.ArrayIO import readArray A = readArray('arrayfile.txt') print A [[1 2 3] [4 5 6] [6 8 9]]