Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

For example, you can parse such matrix printout as

s = '[1 2 3] [4 5 6] [5 6 7]'
M = Matrix(QQ, 3, 3 ,eval('['+s.replace(' ',',')+']') )
print(M)

For example, you can parse such matrix printout as

s = '[1 2 3] [4 5 6] [5 6 7]'
M = Matrix(QQ, 3, 3 ,eval('['+s.replace(' 3, eval('['+s.replace(' ',',')+']') )
print(M)

For example, you can parse such matrix printout as

s = '[1 2 3] [4 5 6] [5 6 7]'
L = eval('['+s.replace(' ',',')+']')
M = Matrix(QQ, 3, 3, eval('['+s.replace(' ',',')+']') )
len(L), len(L[0]), L)
print(M)

For example, you can parse such matrix printout as

s = '[1 2 3] [4 5 6] [5 6 7]'
L = eval('['+s.replace(' ',',')+']')
M = Matrix(QQ, len(L), len(L[0]), L)
eval('['+s.replace(' ',',')+']') )
print(M)