I made a code that should take the number of rows from a txt file and then use this same number of rows in a while to convert the columns and rows to array.
lines = 0
ln = 0
for line in dataset:
line = line.strip()
lines += 1
print (lines, ln)
while ln < (lines):
line1 = dataset.readline()
if not line1: break
words = str.split(line1)
ln += 1
In the case I'm working on, the file has 551 lines, but the code always exits when ln reaches 275