在Python中,可以使用列表(list)來構建二維數組。具體的方法如下:
matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
rows = 3 cols = 3 matrix = [[0 for j in range(cols)] for i in range(rows)]
以上兩種方法都可以創建一個3x3的二維數組,你可以根據實際需求調整行數和列數。