Multidimensional array in Python

前端 未结 12 1529
独厮守ぢ
独厮守ぢ 2021-02-04 15:49

I have a little Java problem I want to translate to Python. Therefor I need a multidimensional array. In Java it looks like:

double dArray[][][] = new double[x.l         


        
12条回答
  •  被撕碎了的回忆
    2021-02-04 16:17

    Easy, when using numpy:

    b = ones((2,3,4)) # creates a 2x3x4 array containing all ones.
    

    'ones' can be replaced with 'zeros'

提交回复
热议问题