Create 3D array using Python

前端 未结 9 1172
情话喂你
情话喂你 2020-12-23 09:57

I would like to create a 3D array in Python (2.7) to use like this:

distance[i][j][k]

And the sizes of the array should be the size of a vari

9条回答
  •  甜味超标
    2020-12-23 10:10

    numpy.arrays are designed just for this case:

     numpy.zeros((i,j,k))
    

    will give you an array of dimensions ijk, filled with zeroes.

    depending what you need it for, numpy may be the right library for your needs.

提交回复
热议问题