How do I open a text file which contain several lists with floats only, read each list in this file and then append a new float to one of those lists?
Read text file with lists:
[1.0, 2.0, 3.1] #list 1
[5.1, 2.9, 7.1] #list 2
[6.6, 7.9, 3.1] #list 3
Open list 2 and append new float; 5.5
Results:
[1.0, 2.0, 3.1] #list 1
[5.1, 2.9, 7.1, 5.5] #list 2
[6.6, 7.9, 3.1] #list 3
I tried using json module and open/write function but i didnt figure it out.
Any good suggestions? :)