Answers for "print 2d array in python"

1

print 2d array in python

for i in A:
    print('\t'.join(map(str, i)))
Posted by: Guest on October-21-2021
5

create a 2d array in python

def build_matrix(rows, cols):
    matrix = []

    for r in range(0, rows):
        matrix.append([0 for c in range(0, cols)])

    return matrix

if __name__ == '__main__':
    build_matrix(6, 10)
Posted by: Guest on February-27-2020
0

python print 2d array as table

import numpy as np
print(np.matrix(A))
Posted by: Guest on March-02-2020
-1

python print 2d array as table

for row in A:
    for val in row:
        print '{:4}'.format(val),
    print
Posted by: Guest on March-20-2020

Python Answers by Framework

Browse Popular Code Answers by Language