[Numpy-discussion] initializing an array of lists

Ravi lists_ravi@lavabit....
Sun Nov 8 19:02:35 CST 2009


On Saturday 07 November 2009 22:56:29 alan@ajackson.org wrote:
> I want to build a 2D array of lists, and so I need to initialize the
> array with empty lists :
> 
> myarray = array([[[],[],[]] ,[[],[],[]]])


In [1]: [[[]]*3]*2
Out[1]: [[[], [], []], [[], [], []]]

Hope this helps.

Ravi



More information about the NumPy-Discussion mailing list