[Numpy-discussion] initializing an array of lists

Alan G Isaac aisaac@american....
Sat Nov 7 22:26:35 CST 2009


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


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

fwiw,
Alan Isaac



More information about the NumPy-Discussion mailing list