def PrintMatrix(mat): for i in mat: print(' '.join(str(j) for j in i)) mat = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] PrintMatrix(mat)