print formating for matrix/table

Robert Kern robert.kern at
Tue Jan 27 01:23:23 CET 2009

On 2009-01-26 18:18, Vincent Davis wrote:
> I have a list of lists....a matrix in that all sub lists are the same
> length. I there a nice why to prin these so that the columns and rows
> line up nicely?
> I have looked around for a good way to do this and haven't found one I
> am like. It seems that all involve repeating a print for each line. I
> would have thought I could find a prebuilt function to do this. Surly
> lots of people are printing matrixes and would like nice formating. So
> what am I missing?

Most people using matrices are also using numpy, and numpy arrays do print with 
columns lined up.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the Python-list mailing list