Using Python 2.7
1) You can multiply a row or column by some scalar s as follows:
M[i, :] *= s M[:, j] *= s
2) You can access a row or column, for example:
M[i, :] M[:, j]
3) You can set a row or column to list l as follows:
M[i, :] = l M[:, j] = l
Note that in the latter case, your list (if you set the column) must be a list in the list (i.e. the external list acts like a row, the internal lists act like columns).
source share