return len(line)
with open('output', 'w') as of:
    for i, d in enumerate(data):
        length_line = write_line(of, i, d)
with open('output', 'rb+') as of:
    n = 2
of.seek(n * length_line)
write_line(of, n, [0.1, 0.1, 0.1, 0.1])
n = 10
of.seek(n * length_line)
write_line(of, n, [0.1, 0.1, 0.1, 0.1])
Editing a single line in a large text file