时间:2021-01-14 11:14:20 | 栏目:Python代码 | 点击:次
我就废话不多说了,直接上代码吧!
>>> matrix=[None]*2 >>> print(matrix) [None, None] >>> for i in range(len(matrix)): matrix[i ]=[0]*3 >>> print(matrix) [[0, 0, 0], [0, 0, 0]] >>>
例
n = 2 m = 3 matrix = [None]*2 for i in range(len(matrix)): matrix[i] = [0]*3 print(matrix)