Add commas after matrix-elements in matrix()
I want to replace the brackets, but to add commas after each matrix-element, except the last ones in the rows.
I get only the first part.
Is there an elementary way to add commas to the sage-matrix?
Because matrix()
has the great advantage that the elements are aligned in all cases.
m = matrix([[2222,333,44444], [1,0,0]])
mymatrix = m.str().replace('[', '').replace(']', '') # replace [, ]
#.... # add commas
print mymatrix
Out Actual:
2222 333 44444
1 0 0
Out Target:
2222, 333, 44444
1, 0, 0