python create double array code example
Example 1: python create n*n matrix
# Creates a list containing 5 lists, each of 8 items, all set to 0
w, h = 8, 5;
Matrix = [[0 for x in range(w)] for y in range(h)]
Example 2: 2d array python
array = [[value] * lenght] * height
//example
array = [[0] * 5] * 10
print(array)
Example 3: python print 2d array as table
for row in A:
for val in row:
print '{:4}'.format(val),
print
Example 4: python print 2d array as table
import numpy as np
print(np.matrix(A))