(a) For a matrix of real values to 1 d.p.:
>>> a11, a12, a13 = 0., 3.4, -1.2
>>> a21, a22, a23 = -1.1, 0.5, -0.2
>>> a31, a32, a33 = 2.3, -1.4, -0.7
>>> rfmt1 = '[ {:4.1f} {:4.1f} {:4.1f} ]'
>>> print(rfmt1.format(a11,a12,a13),
... rfmt1.format(a21,a22,a23),
... rfmt1.format(a31,a32,a33),
... sep='\n')
...
[ 0.0 3.4 -1.2 ]
[ -1.1 0.5 -0.2 ]
[ 2.3 -1.4 -0.7 ]
(b) For a matrix of one-digit integers:
>>> b11, b12, b13 = 0, 1, 0
>>> b21, b22, b23 = 0, 0, 1
>>> b31, b32, b33 = 0, 0, 1
>>> rfmt2 = '[ {:1d} {:1d} {:1d} ]'
>>> print(rfmt2.format(b11,b12,b13),
... rfmt2.format(b21,b22,b23),
... rfmt2.format(b31,b32,b33),
... sep='\n')
...
[ 0 1 0 ]
[ 0 0 1 ]
[ 1 0 0 ]