I have txt-file in the form:
1 2 3 4 5 6
7 8 9 10 11
12 13 14 15
So for me, the lines are obviously seperated by beginning a new line.
Now I want to read these lines and store every line to a new variable. I tried:
with open('centroids_ET.txt') as f:
CD_cent=f.readlines()
and also:
with open('centroids_ET.txt') as f:
CD_cent = []
for line in f:
CD_cent.append(line)
But It always stores all other lines in this variable as well.
I checked with print(len(line))
if it recognizes all lines, but it takes all as one line as it seems.
So my question, how can I fix this? Is it maybe an issue of the layout of the txt-file? Do I need to seperate the lines in the txt-file in a special way? Thanks in advance!