Are you looking for something to run on the command line? If so, you can simply write your little function in a few lines. Something like that:
>>> matrix = [[0,1,0],[1,1,1],[0,0,1]] >>> convert = lambda x : '■ ' if x == 1 else '□ ' >>> for row in matrix: ... print ''.join([convert(el) for el in row]) ... □ ■ □ ■ ■ ■ □ □ ■
source share