Print a nested list line by line
A = [[1, 2, 3], [2, 3, 4], [4, 5, 6]] print("OUTPUT1: ") [print(a) for a in A]; ''' OUTPUT1: [1, 2, 3] [2, 3, 4] [4, 5, 6] ''' # -------------------------------------------------------------- # if you don't want to see [] in the printout, then do # [print(*a) for a in A]; A = [[1, 2, 3], [2, 3, 4], [4, 5, 6]] print("\nOUTPUT2: ") [print(*a) for a in A]; ''' OUTPUT2: 1 2 3 2 3 4 4 5 6 '''
Source: stackoverflow.com