📜  二维数组python代码示例

📅  最后修改于: 2022-03-11 14:46:20.985000             🧑  作者: Mango

代码示例1
# Creates a list containing 5 lists, each of 8 items, all set to 0
w, h = 8, 5;
Matrix = [[0 for y in range(h)] for x in range(w)] 

Matrix[0][0] = 1
Matrix[0][6] = 3 # error! range... 
Matrix[6][0] = 3 # valid