(Jun-28-2021, 02:25 AM)Larz60+ Wrote: what have you tried?
EDIT
For now I can only read the column of numbers from "input.txt" file and write 4 files for the 4 subdivisions:
input.txt file:
5 77 1 -4 9 17 13 2 1 5 63 8
#python3.6 import numpy as np d = np.loadtxt('input.txt') A= 4 B= 2 C= 5 D= 1 with open('output1.txt', 'w') as f_out: for i in range(0,A): f_out.write(f"{d[i]}\n") with open('output2.txt', 'w') as f_out: for i in range(A,A+B): f_out.write(f"{d[i]}\n") with open('output3.txt', 'w') as f_out: for i in range(A+B,A+B+C): f_out.write(f"{d[i]}\n") with open('output4.txt', 'w') as f_out: for i in range(A+B+C,A+B+C+D): f_out.write(f"{d[i]}\n")output1.txt file:
Output:5
77
1
-4
output2.txt file:Output:9
17
output3.txt file:Output:13
2
1
5
63
output4.txt file:Output:8
But I'm trying to write only one text file with 4 columns.Bye,
m.