matrix = [[1, 2]] rows = len(matrix) # Height. columns = len(matrix[0]) # Width. print(rows) print(columns)
>>> a=[[1,5,6,8],[1,2,5,9],[7,5,6,2]] >>> len(a) 3 >>> len(a[0]) 4