I am trying to read a txt file in he format:
[text]
[text]
[text]
1 0
4 5
3 0 0
[text]
.
.
.
I need to read lines 4 to 6 as a numpy array. So far I've got:
lines=[]
with open('filename', "r") as f:
for i, line in enumerate(f):
if i>=3 and i<=5:
lines.append(line)
lines = np.array(lines)
This reads each of the required lines as an element, but I need to have numbers in separate columns as separate elements. Is there a way around this?
Thanks