Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

print nested list in new lines in python

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("
OUTPUT2: ")
[print(*a) for a in A];
'''
OUTPUT2:
1 2 3
2 3 4
4 5 6
'''
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #nested #list #lines #python
ADD COMMENT
Topic
Name
4+4 =