print formating for matrix/table
Robert Kern
robert.kern at gmail.com
Mon Jan 26 21:03:30 EST 2009
On 2009-01-26 19:53, Vincent Davis wrote:
> I do have numpy but am using lists as did not need any functions of
> array. Well maybe print now. I am new to python and don't really know
> the details about the difference between lists and arrays. I do know
> that there are different/additional functions available for arrays.
Python lists are one-dimensional, appendable sequences of heterogeneous Python
objects. numpy arrays are multi-dimensional, non-appendable containers usually
of homogeneously-typed numerical data (but can also contain heterogeneous Python
objects, too). numpy arrays have many conveniences over lists of lists if you
need to do math on bunches of numbers.
> Anyway is this the best solution, convert the list to an array before
> printing?
I wouldn't use numpy *just* for this, but I suspect that you could actually use
numpy for other things if you are actually using your lists of lists as matrices.
--
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