import numpy as np
matrix = [
[1,2,3,4],
[5,6,7,8],
[9,10,11,12]
]
q1 = np.insert(matrix, 1, [1,1,1,1], 0)
print('>>>>q1>>>>\n',q1)
q2 = np.insert(matrix, 0, [1,1,1], 1)
print('>>>>q2>>>>\n',q2)
q3 = np.insert(matrix, 3, [1,1,1,1], 0)
print('>>>>q3>>>>\n',q3)
>>>>q1>>>>
[[ 1 2 3 4]
[ 1 1 1 1]
[ 5 6 7 8]
[ 9 10 11 12]]
>>>>q2>>>>
[[ 1 1 2 3 4]
[ 1 5 6 7 8]
[ 1 9 10 11 12]]
>>>>q3>>>>
[[ 1 2 3 4]
[ 5 6 7 8]
[ 9 10 11 12]
[ 1 1 1 1]]