temp1 = [[] for i in range(10)]temp2 = [temp1 for i in range(20)]temp3 = [temp2 for i in range(30)]for i in range(30): for j in range(20): for k in range(10): temp3[i][j][k] = 0
但是赋值的时候还是发现是指向同一地址的
所以还得这样
matrix3d=[]for i in range(30): matrix3d.append([]) for j in range(20): matrix3d[i].append([]) for k in range(10): matrix3d[i][j].append(0)