Z = [[0 for i in range(10)] for j in range(10)]#初始化10位的二维数组
X = range(10)#初始化10位的数组
Y = range(10)
for x in X:#从0开始循环到X列表完
for y in Y:
Z[x][y] = (x + 1)*(y + 1)
print (Z)
得到结果
[[1,2,3,4,5,6,7,8,9,10]
[2,4,6,8,10,12,14,16,18,20]
[3,6,9,12,15,18,21,24,27,30]
.....
[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]]