[Numpy-discussion] initializing an array of lists

Ravi lists_ravi at lavabit.com
Sun Nov 8 20:02:35 EST 2009


On Saturday 07 November 2009 22:56:29 alan at 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