tokens = f.read().split()
rows = []
for idx, token in enumerate(tokens):
    if idx % 8 == 0:
        row = []
rows.append(row)
row.append(token)
Python: How to read a data file with uneven number of columns