Creating a Matrix in Python without numpy [duplicate]
问题 This question already has answers here : How do you split a list into evenly sized chunks? (63 answers) Closed 3 years ago . I'm trying to create and initialize a matrix. Where I'm having an issue is that each row of my matrix I create is the same, rather than moving through the data set. I've tried to correct it by checking if the value was already in the matrix and that didn't solve my problem. def createMatrix(rowCount, colCount, dataList): mat = [] for i in range (rowCount): rowList = []