How to get all elements of 2D array by slice in python

Viewed 5418

I want to set value of G[1][0],G[1][1]...G[1][100] and G[0][1],G[1][1]...G[100][1] to be 1

G = [[0]*101]*101
G[1][:] = 1
G[:][1] = 1

Than I got error,

...
G[1][:] = 1
TypeError: can only assign an iterable

how can I do this without Numpy?

4 Answers
Related