I want to print all elements of a list A
in vertical format. I present the current and expected output.
A=[[1, 2, 3, 4, 5, 6, 7, 8, 10],[15,19,21,11,18]]
print(*A)
The current output is
[1, 2, 3, 4, 5, 6, 7, 8, 10] [15, 19, 21, 11, 18]
The expected output is
[[1,
2,
3,
4,
5,
6,
7,
8,
10],
[15,
19,
21,
11,
18]]
CodePudding user response:
You can use print
like this:
print(
'[[', '],\n['.join(
[str(',\n'.join(
[str(i) for i in j]
)) for j in A]
),
end=']]',
sep=''
)