Find length of 2D array Python

前端 未结 6 1642
一生所求
一生所求 2020-12-07 15:48

How do I find how many rows and columns are in a 2d array?

For example,

Input = ([[1, 2], [3, 4], [5, 6]])`

should be displaye

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 16:06

    Assuming input[row][col],

        rows = len(input)
        cols = map(len, input)  #list of column lengths
    

提交回复
热议问题