代码语言:javascript复制
def makeMatrix(row_num, column_num, start=0.1, step=0):
matrix = []
row = []
for i in range(row_num):
for j in range(column_num):
row.append(start)
start = step
matrix.append(row)
row = []
return matrix
参数解释:row_num=行数 column_num = 列数 start=第一行第一列元素的值 step=步长
经常用到,记录一下