[Numpy-discussion] initializing an array of lists

Alan G Isaac aisaac at american.edu
Sat Nov 7 23:26:35 EST 2009


On 11/7/2009 10:56 PM, 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([[[],[],[]] ,[[],[],[]]])


[[[] for i in range(3)] for j in range(2) ]

fwiw,
Alan Isaac




More information about the NumPy-Discussion mailing list