I have a 1D array e.g. arr1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...] of arbitrary length.
How do I print this to a text file (with integers/floats separated by spaces) so that every 7 elements are printed on the same line in the text file?
So I want the text file to look like this:
Line 1:1 2 3 4 5 6 7
Line 2:8 9 10 11 12 13 14
you could do this:
here every 7 items a new line is appended… output looks like this:
hope that helps!