in order to generate such a matrix, in python, you must use the comprihention list, as if you want to create a row with all 0,
>>> import copy >>> list_MatrixRow=[0 for i in range(12)] >>> list_MatrixRow [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
so you can create a list of the list in the same way
list_Matrix = [[0 for j in range (12)] for i in range (8)]
now you can edit any elements
>>> list_Matrix[0][2]=12345 >>> list_Matrix[0][2] 12345 >>> list_Matrix [[0, 0, 12345, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
if you want to create a matrix containing all columns of 5, you can use a short circuit estimate when understanding the list
>>> list_MatrixRow=[(i==0 and 5 or 0) for i in range(12)] >>> list_MatrixRow [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >>> list_Matrix=[list_MatrixRow for i in range(8)] >>> list_MatrixRow [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] >>> list_Matrix [[5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]] >>> list_Matrix[0][0] 5