[Solved] How to vertically print 2d list with different lengths in python


a = [[0, 1], [0, 1, 2], [0, 1, 2, 3]]
print '\n'.join(['\t'.join([str(x[i]) if len(x) > i else '' for x in a]) for i in range(len(max(a)))])

#0    0    0
#1    1    1
#     2    2
#          3

1

solved How to vertically print 2d list with different lengths in python