Is there a good way to print a large list in multiple lines? Assume that a list has 10000 elements and by writing that to a file it goes all in a single line which is difficult for text editors to open that.
I know I can iterate over the size with a counter and print \n
after each 1000 elements. For example:
my_list = [0,1,2,3,4,5,6,7,8,9]
x = 0
for i in my_list:
if x % 5 == 0:
print()
print(i, end='')
x += 1
prints
01234
56789
I wonder if there is a Python function for that to do that in a more efficient way.