reshape a list?

Robert Kern robert.kern at gmail.com
Mon Mar 6 23:31:36 EST 2006


Michael Spencer wrote:
> Robert Kern wrote:
> 
>>KraftDiner wrote:
>>
>>>I have a list that starts out as a two dimensional list
>>>I convert it to  a 1D list by:
>>>
>>>b = sum(a, [])
>>>
>>>any idea how I can take be and convert it back to a 2D list?
>>
>>Alternatively, you could use real multidimensional arrays instead of faking it
>>with lists.
> 
> Or, you can fake real multidimensional arrays with lists ;-)
> 
> pyarray is a pure-Python single-module implementation of a multi-dimensional 
> array type.
> 
> Download from http://svn.brownspencer.com/pyarray/trunk/pyarray.py

That's fine, too.  :-)

It's just that trying to do it *again* is a silly waste of time.

-- 
Robert Kern
robert.kern at gmail.com

"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