print formating for matrix/table

Vincent Davis vincent at vincentdavis.net
Mon Jan 26 20:53:47 EST 2009


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.Anyway is this the best
solution, convert the list to an array before printing?

Thanks
Vincent Davis



On Mon, Jan 26, 2009 at 5:23 PM, Robert Kern <robert.kern at gmail.com> wrote:

> 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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090126/d220cdbf/attachment.html>


More information about the Python-list mailing list