如何找到二维数组中的行和列数?
例如,
Input = ([[1, 2], [3, 4], [5, 6]])`
应该显示为3行2列。
Answers:
像这样:
numrows = len(input) # 3 rows in your example
numcols = len(input[0]) # 2 columns in your example
假定所有子列表具有相同的长度(也就是说,它不是锯齿状的数组)。
Range(n)
已经给出0,1,...,n-1。
此外,计算总物料编号的正确方法是:
sum(len(x) for x in input)